[Fix #381] Fixing null pointer#382
Conversation
41b6aeb to
6184705
Compare
|
Thank you for reporting and submitting a patch! This clearly fixes the issue for |
I filed a new commit that change the mutate. To be honest, I was lazy and did not want to search which mutate implementation I have to change. Now that you give me the clue, I have no excuse ;) |
| if (newval != null) | ||
| JsonNode newval = newobj.get(key); | ||
| newval = mutation.apply(newval != null ? newval : NullNode.getInstance()); | ||
| if (newval != null && !newval.isNull()) |
There was a problem hiding this comment.
JSON null (NullNode) is a valid value for object fields, so && !newval.isNull() is unnecessary.
$ jq -c '.foo += null' <<< '{}'
{"foo":null}
Other than that, the patch looks good 👍
There was a problem hiding this comment.
If I remove the isNull, a lot of test will fail (acutally it took me a while to figure out that). The reason is the same why you add the original null check, to prevent null values to be added to the object (you have some unit test to prevent that)
|
After taking a closer look at the code, I'm convinced that your first patch was the right way to fix the issue. Can you push the original patch again? Sorry for the confusion and taking me so long to respond. A couple of remarks:
|
This reverts commit b4be882.
|
@eiiches Original approach restored. Thanks a lot for your inshights and time |
Fix #381