Fixing issue 343 (NullPointerException when no map file present) in 0.3.0

25 views
Skip to first unread message

Nick Whitelegg

unread,
Jan 24, 2013, 8:01:16 AM1/24/13
to mapsfo...@googlegroups.com
Hi, 

I'd like to modify the mapsforge 0.3.0 source code to fix issue 343:


I want to stick with 0.3.0 as I don't want to completely rewrite sections of my app for the svn version.

The issue is a NullPointerException on line 247:

queryParameters.queryZoomLevel = this.mapFileHeader.getQueryZoomLevel(tile.zoomLevel);

I presume therefore this.mapFileHeader is the null object in which case will a simple if round the block of code which does things with this.mapFileHeader correct the problem?

Thanks,
Nick

Ludwig

unread,
Jan 24, 2013, 9:09:12 PM1/24/13
to mapsfo...@googlegroups.com
This is an open source project so you are free to modify the source to fit your needs. But equally it means that you need to put the effort in yourself. 

Obviously, the NPE should not happen, but in other ways you are trying to use the library in a way that was not intended (without a map file), so it is difficult to predict what will happen if you just catch this exception and ignore it. My hunch is that you will simply run into the next NPE a bit further down the line. 

My understanding is that you want to use only the overlay facilities without an underlying map. I would suggest that you use an empty mapfile rather than an passing a null pointer to the setMapFile call.

HTH
Ludwig


--
 
 

Reply all
Reply to author
Forward
0 new messages