tordanik / OSM2World

converter that creates three-dimensional models of the world from OpenStreetMap data
http://osm2world.org/
GNU Lesser General Public License v3.0
552 stars 123 forks source link

Command line: missing camera/projection causes NPE #69

Open tordanik opened 11 years ago

tordanik commented 11 years ago

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 commented 11 years ago

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.

Lan5432 commented 8 years ago

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.

tordanik commented 8 years ago

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.