NullPointerException in MapView.getZoomLevel()
===

I'm getting very weird NullPointerException when trying to get current zoom level from my MapView. The problem is that this occurs not every time and happens somewhere inside <b>`getZoomLevel()`</b> function. Investigating the source code of this function shows that this is just a getter function and NullPointerException should not potentially happen here. The mapView itself is not null at the time it happens and calls to other MapView interfaces (such as `getProjection()` work fine).

Here is a brief background of my code structure:

I have map view and ItemizedOverlay with certain amount of items. When I have new data - I need to coalesce items which are close to each other. One of the params to `coalesce()` function is current zoom level which in theory I should be able to get from my MapView.

I tried to place call to `coalesce()` inside uiThread but I still get NullPointerException sometimes.

I managed to workaround this issue by keeping track of last known zoomLevel within my custom map view and returning it when `getZoomLevel` fails:

    public final int getCurrentZoomLevel() 
    {
        try 
        {
            return this.getZoomLevel();
        } catch (Exception ex) 
        {
            ex.printStackTrace();
            return lastZoomLevel;
        }
    }

But still, I'm curious why it happens.
It happens on different devices and different Android versions.

Here is stack trace:

    07-18 11:31:22.435: W/System.err(8054): java.lang.NullPointerException
    07-18 11:31:22.435: W/System.err(8054): 	at com.google.android.maps.MapView.getZoomLevel(MapView.java:1094)
    07-18 11:31:22.435: W/System.err(8054): 	at com.inrix.lib.view.CustomMapView.getCurrentZoomLevel(CustomMapView.java:195)
    07-18 11:31:22.435: W/System.err(8054): 	at com.inrix.lib.mapitems.incidents.IncidentMapItemOverlay.performCoalesceInternal(IncidentMapItemOverlay.java:109)
    07-18 11:31:22.435: W/System.err(8054): 	at com.inrix.lib.mapitems.MapItemsOverlay$4.run(MapItemsOverlay.java:448)
    07-18 11:31:22.435: W/System.err(8054): 	at java.lang.Thread.run(Thread.java:1096)
    07-18 11:31:22.435: W/System.err(8054): 	at com.inrix.lib.mapitems.MapItemsOverlay.recoalesce(MapItemsOverlay.java:450)
    07-18 11:31:22.442: W/System.err(8054): 	at com.inrix.lib.mapitems.MapItemsOverlay$2.run(MapItemsOverlay.java:281)
    07-18 11:31:22.442: W/System.err(8054): 	at android.os.Handler.handleCallback(Handler.java:587)
    07-18 11:31:22.442: W/System.err(8054): 	at android.os.Handler.dispatchMessage(Handler.java:92)
    07-18 11:31:22.442: W/System.err(8054): 	at android.os.Looper.loop(Looper.java:123)
    07-18 11:31:22.442: W/System.err(8054): 	at android.app.ActivityThread.main(ActivityThread.java:4627)
    07-18 11:31:22.442: W/System.err(8054): 	at java.lang.reflect.Method.invokeNative(Native Method)
    07-18 11:31:22.442: W/System.err(8054): 	at java.lang.reflect.Method.invoke(Method.java:521)
    07-18 11:31:22.442: W/System.err(8054): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
    07-18 11:31:22.442: W/System.err(8054): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    07-18 11:31:22.442: W/System.err(8054): 	at dalvik.system.NativeStart.main(Native Method)

Call to `coalesce` looks like:

    protected void performCoalesceInternal(IOnCoalesceCompleteListener callback) 
    {
        if (callback != null) 
        {
            callback.onCoalesceComplete(coalescer.coalesce(
                    mapItemsController.getRawItemsCollection(), 
                    MapItemType.Incident,  
                    mapView.getCurrentZoomLevel(), 
                    mapView.getProjection()));
        }
    }

Please note that I have NullPointerException only on `getZoomLevel()` call. `mapView.getProjection()` works fine.