Random NullPointerException
Sometimes the pathfinder will throw a random NPE. I've been unable to consistently reproduce it, but I'm pretty sure it might be specific to certain positions in the world.
Here's the stacktrace:
java.lang.NullPointerException
at hxDaedalus.data.math.Geom2D.getRelativePosition2(Geom2D.java:494)
at hxDaedalus.ai.Funnel.findPath(Funnel.java:377)
at hxDaedalus.ai.PathFinder.findPath(PathFinder.java:120)
at com.dongbat.walkable.PathHelper.doFindPath(PathHelper.java:178)
at com.dongbat.walkable.PathHelper.findPath(PathHelper.java:227)
It seems that in the method getRelativePosition2, either the eUp, eUp.get_originVertex() or eUp.get_destinationVertex() is null, but I'll have to test with some debugging code to be sure.
I'm pretty sure that it's the case the target position is inside entity's radius.
We can check that first and through an unchecked error.
Can you test that and make a PR for the lazy man :)
Sure, I'll look into it and report back 😃
Any updates on this?
I have the same issue
java.lang.NullPointerException: Cannot invoke "hxDaedalus.data.Edge.get_originVertex()" because "eUp" is null
at hxDaedalus.data.math.Geom2D.getRelativePosition2(Geom2D.java:494)
at hxDaedalus.ai.Funnel.findPath(Funnel.java:377)
at hxDaedalus.ai.PathFinder.findPath(PathFinder.java:120)
Sorry, no updates right now. For the project I was working on, I ended up using gdx-ai's A* pathfinder instead, and then the project was abandoned a while later. If you can share some info about your setup and code that might help diagnose the issue.
Hi @mattyoung101
I am using this with jMonkeyEngine. This is a simple test and there is just one large rectangular obstacle in the scene and the player is inside the obstacle and can move inside it. Sometimes when I want to find a path from player location to somewhere inside the obstacle it throws this NPE.
Note, the target position that I want to find the path to it, is not inside entities radius.
If there is no path, I believe that it won’t throw NPE when findPath is called.
It should be that the destination is inside entity’s radius or the destination combined with radius contains the obstacle.
Maybe you have some mistakes with the unit when debug drawing. Can you upload your current code so I can take a look?