NASAWorldWind / WorldWindJava

The NASA WorldWind Java SDK (WWJ) is for building cross-platform 3D geospatial desktop applications in Java.
714 stars 324 forks source link

RigidShape Line intersection #95

Open fernandocarrillo opened 7 years ago

fernandocarrillo commented 7 years ago

I'm trying to create a cone and search for insertion points with a line

I get this error:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at gov.nasa.worldwind.render.RigidShape.intersect(RigidShape.java:1540) at gov.nasa.worldwind.render.RigidShape.intersect(RigidShape.java:1526)

Checking if "this.getCurrentShapeData()" is null solves the problem.

Actual Code: if (this.getCurrentShapeData().getMesh(index).getBuffer(Geometry.VERTEX) == null) return null;

Bugfix Code:
if (this.getCurrentShapeData() !=null && this.getCurrentShapeData().getMesh(index).getBuffer(Geometry.VERTEX) == null) return null;

basisbit commented 7 years ago

this null check should not be necessary. Rather check why getCurrentShapeData returns null and fill that correctly.