OSM2World icon indicating copy to clipboard operation
OSM2World copied to clipboard

Command line: missing camera/projection causes NPE

Open tordanik opened this issue 12 years ago • 3 comments

Entirely omitting camera information with PNG output causes a NullPointerException:

Exception in thread "main" java.lang.NullPointerException
        at org.osm2world.core.target.jogl.JOGLTarget.applyProjectionMatricesForPart(JOGLTarget.java:320)
        at org.osm2world.core.target.jogl.JOGLTarget.renderPart(JOGLTarget.java:245)
        at org.osm2world.console.ImageExporter.writeImageFile(ImageExporter.java:250)
        at org.osm2world.console.Output.output(Output.java:159)
        at org.osm2world.console.OSM2World.executeArgumentsGroup(OSM2World.java:199)
        at org.osm2world.console.OSM2World.main(OSM2World.java:130)

It would be preferable to fall back to the bounds in the data file and/or print a better warning.

tordanik avatar May 27 '13 23:05 tordanik

I believe what happens is that the fields initialized with null in Output.java keep that value because none of the if - else if blocks is reached, and it is then passed into the ImageExporter and JOGLTarget methods.

tordanik avatar May 27 '13 23:05 tordanik

Excuse me, but to better understand this. The problem is that ConversionFacade cf is not properly set up in lines 53-75 because no conditional branch is triggered? And then something breaks when calling a method in JOGLTarget?

Thanks in advance.

Lan5432 avatar Mar 05 '16 11:03 Lan5432

The problem is actually in the section between the lines 84 and 134. The camera and projection variables are never set in some cases, which causes the NPE.

tordanik avatar Mar 21 '16 16:03 tordanik