diff --git a/json_rpc/jsonmarshal.nim b/json_rpc/jsonmarshal.nim index 3b21e39..2e33f5f 100644 --- a/json_rpc/jsonmarshal.nim +++ b/json_rpc/jsonmarshal.nim @@ -9,8 +9,11 @@ proc `%`*(n: byte{not lit}): JsonNode = proc `%`*(n: uint64{not lit}): JsonNode = result = newJInt(int(n)) -proc `%`*(n: ref int|ref int64): JsonNode = - result = newJInt(int(n[])) +proc `%`*(n: ref int | ref int64): JsonNode = + if n.isNil: + result = newJNull() + else: + result = newJInt(n[]) # Compiler requires forward decl when processing out of module proc fromJson(n: JsonNode, argName: string, result: var bool)