NPE in PhysicsPicker

Hi,



I’ve encountered a NPE within the PhysicsPicker whilst dragging a non physics object.

One of my game objects (a non-physics node) is dragged using the following code http://www.jmonkeyengine.com/jmeforum/index.php?topic=3635.0.



The NPE occurs when I click and drag the non-physics object as above. The mouse is clicked near a Sphere and a Line node.


INFO: Moving targetPoint from com.jme.math.Vector3f [X=72.0991, Y=214.10696, Z=188.66808] to com.jme.math.Vector3f [X=72.0991, Y=214.10696, Z=188.66808]
java.lang.NullPointerException
   at com.jmex.physics.util.PhysicsPicker$PickAction.performAction(PhysicsPicker.java:137)
   at com.jme.input.ActionTrigger.performAction(ActionTrigger.java:264)
   at com.jme.input.InputHandler.processTriggers(InputHandler.java:376)
   at com.jme.input.InputHandler.update(InputHandler.java:361)
   at com.jme.input.InputHandler.updateAttachedHandlers(InputHandler.java:390)
   at com.jme.input.InputHandler.update(InputHandler.java:362)
   at org.chrismills.stuntrobot.GameWorldState.stateUpdate(GameWorldState.java:683)
   at com.jmex.game.state.StandardGameStateDefaultCamera.update(StandardGameStateDefaultCamera.java:90)
   at com.jmex.game.state.GameStateNode.update(GameStateNode.java:71)
   at org.chrismills.stuntrobot.StuntGame.update(StuntGame.java:161)
   at com.jme.app.BaseGame.start(BaseGame.java:66)
   at org.chrismills.stuntrobot.StuntGame.main(StuntGame.java:52)
11/11/2006 10:08:32 org.chrismills.stuntrobot.StuntGame cleanup



The NPE occurs at the following line

                   if ( data.getTargetTris().size() > 0 ) {

within the PhysicsPicker (latest CVS version). By stepping through the code, getTargetTris() returns null for one of the pickdata objects.

Does this issue just require a null check within PhysicsPicker

                   if (data.getTargetTris() &&  data.getTargetTris().size() > 0 ) {


or am I doing something wrong?

Ok, I've isolated the problem to a custom object I've subclassed from a com.jme.scene.Line node.

By not setting the modelBounds, I've removed it from the PickResults and removed my current NPE problem.



However I'm sure someone else will encounter this issue in the future. Given that lines can have a thickness, they should be able to have a bounding box, and not subsequently crash the PhysicsPicker.


sure that != null check is fine with me - checked in

Wonderful! thanks.