diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-11-04 14:24:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 01:24:40 -0500 |
commit | 7d640e0943679a772f9595ef3be56fe2158b0912 (patch) | |
tree | b25f64f7baf34f5dc4180650432841d76273c0bd /lib/pure | |
parent | b0e26d8fbffd044aa3f23fc680e6a2e666593399 (diff) | |
download | Nim-7d640e0943679a772f9595ef3be56fe2158b0912.tar.gz |
fix #15835 (#15838)
* fix #15835 * add tests
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/json.nim | 2 |
1 files changed, 2 insertions, 0 deletions
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) = |