1

I have a new error in my repast simphony model. When my agent give birth and I contextualize its childs in the context, the next step gives me an error like java.lang.NullPointerException (See source code). Can you help me to fix it?

java.lang.NullPointerException

at saf.v3d.scene.VComposite.addChild(VComposite.java:46)
    at repast.simphony.visualizationOGL2D.SpatialWrapper.setChild(SpatialWrapper.java:80)
    at repast.simphony.visualizationOGL2D.SpatialWrapper.<init>(SpatialWrapper.java:34)
    at repast.simphony.visualizationOGL2D.StyledDisplayLayerOGL2D.createSpatial(StyledDisplayLayerOGL2D.java:146)
    at repast.simphony.visualizationOGL2D.StyledDisplayLayerOGL2D.processAdded(StyledDisplayLayerOGL2D.java:228)
    at repast.simphony.visualizationOGL2D.StyledDisplayLayerOGL2D.update(StyledDisplayLayerOGL2D.java:250)
    at repast.simphony.visualizationOGL2D.DisplayOGL2D.update(DisplayOGL2D.java:404)
    at repast.simphony.visualization.engine.DisplayComponentControllerAction$DisplayUpdater.execute(DisplayComponentControllerAction.java:44)
    at repast.simphony.engine.schedule.DefaultAction.execute(DefaultAction.java:38)
    at repast.simphony.engine.schedule.ScheduleGroup.executeList(ScheduleGroup.java:205)
    at repast.simphony.engine.schedule.ScheduleGroup.execute(ScheduleGroup.java:238)
    at repast.simphony.engine.schedule.Schedule.execute(Schedule.java:352)
    at repast.simphony.ui.GUIScheduleRunner$ScheduleLoopRunnable.run(GUIScheduleRunner.java:52)
    at java.lang.Thread.run(Unknown Source)
Avinash Singh
  • 4,970
  • 8
  • 20
  • 35

1 Answers1

2

This error can occur if the getVSpatial method in the style for child agent returns null.

JavaDoc for getVSpatial

When the child is created the second argument to getVSpatial is null, so you need to be sure to return a VSpatial implementation.

Nick Collier
  • 1,786
  • 9
  • 10