xitingTick / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

NullPointerException during in Projection.toPixel() from MapController.animateTo() #540

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I updated osmdroid from 4.1 to 4.2 (as well as osmbonuspack to 4.6)
2. In LocationOverlay.runOnFirstFix(), use the location returned by 
LocationOverlay.getMyLocation() for animateTo() of the MapController

What is the expected output? What do you see instead?

Worked fine with 4.1: the map scrolled to the given location. Now with 4.2 the 
application crashes due to a NullPointerException in Projection.toPixels()

What version of the product are you using? On what operating system?
osmdroid 4.2, Android 4.4.3

Please provide any additional information below.

java.lang.NullPointerException
            at org.osmdroid.views.Projection.toPixels(Projection.java:103)
            at org.osmdroid.views.MapController.animateTo(MapController.java:110)

Original issue reported on code.google.com by carsten....@bitz.it on 25 Jun 2014 at 10:46

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The problem is that MyLocationNewOverlay.getMyLocation() now returns null 
instead of a valid location, even though it is called from inside 
MyLocationNewOverlay.runOnFirstFix(). The current location returned by the 
overlay shouldn't be null if a location fix was signaled.

Original comment by carsten....@bitz.it on 25 Jun 2014 at 10:54

GoogleCodeExporter commented 8 years ago
We have migrated to github for this project. Please leave all future issues on 
that page. I have looked at this and added a new issue: 
https://github.com/osmdroid/osmdroid/issues/47

However, runOnFirstFix() runs in its own thread so you should absolutely not be 
touching the UI in that thread. You need to push your runOnFirstFix Runnable 
back onto the main thread with a Handler.

Original comment by kurtzm...@gmail.com on 25 Jun 2014 at 1:47

GoogleCodeExporter commented 8 years ago
Sorry about posting here, it was the repo I remembered and I went to the issues 
immediately.

Thanks for opening a new issue there, and for the hint regarding the UI thread. 
I actually was using a separate runOnUiThread, but didn't think about the fact 
that animating to a certain location touches the UI, too. I will fix that in my 
code.

Original comment by carsten....@bitz.it on 25 Jun 2014 at 2:14

GoogleCodeExporter commented 8 years ago

Original comment by neilboyd on 13 Aug 2014 at 12:37