From 7d640e0943679a772f9595ef3be56fe2158b0912 Mon Sep 17 00:00:00 2001 From: flywind <43030857+xflywind@users.noreply.github.com> Date: Wed, 4 Nov 2020 14:24:40 +0800 Subject: fix #15835 (#15838) * fix #15835 * add tests --- lib/pure/json.nim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/pure') diff --git a/lib/pure/json.nim b/lib/pure/json.nim index f3145301f..a3f7a782e 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -1052,6 +1052,8 @@ when defined(nimFixedForwardGeneric): dst = jsonNode.bval proc initFromJson(dst: var JsonNode; jsonNode: JsonNode; jsonPath: var string) = + if jsonNode == nil: + raise newException(KeyError, "key not found: " & jsonPath) dst = jsonNode.copy proc initFromJson[T: SomeInteger](dst: var T; jsonNode: JsonNode, jsonPath: var string) = -- cgit 1.4.1-2-gfad0