Skip to content

Patch for when JsonNode child is null #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Pluggr
Copy link

@Pluggr Pluggr commented Jun 14, 2022

I ran into this bug running Mendix 9.14. but i think this issue is applicable regardless of Mendix version.

This patch prevents running into NullPointerException when traversable(child) is called while child = null

Here an example of the error it will prevent.


Caused by: java.lang.NullPointerException: null
	at jsontotree.Misc.traversable(Misc.java:96)
	at jsontotree.Misc.traverseObject(Misc.java:61)
	at jsontotree.Misc.traverse(Misc.java:44)
	at jsontotree.Misc.traverseArray(Misc.java:84)
	at jsontotree.Misc.traverse(Misc.java:42)
	at jsontotree.Misc.traverseRootObjects(Misc.java:28)
	at jsontotree.actions.ConvertJSONToRootTree.executeAction(ConvertJSONToRootTree.java:52)

This prevents running into NullPointerException when traversable(child) is called while child = null

Here an example of the error it will prevent.


``` 

Caused by: java.lang.NullPointerException: null
	at jsontotree.Misc.traversable(Misc.java:96)
	at jsontotree.Misc.traverseObject(Misc.java:61)
	at jsontotree.Misc.traverse(Misc.java:44)
	at jsontotree.Misc.traverseArray(Misc.java:84)
	at jsontotree.Misc.traverse(Misc.java:42)
	at jsontotree.Misc.traverseRootObjects(Misc.java:28)
	at jsontotree.actions.ConvertJSONToRootTree.executeAction(ConvertJSONToRootTree.java:52)

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant