torkildr/Trommelyd — Issue #1: Crash on uninitialized service
Author: torkildr
Created: 2011-10-28 14:00:53+00:00
State: open

The following stack trace is reported in some cases.

The problem here is that the service, for some reason, is not initialized when the callback code for the accelerometer event is triggered. This should be handled properly.

```
java.lang.NullPointerException
at no.trommelyd.android.TrommelydActivity$2.run(TrommelydActivity.java:241)
at no.trommelyd.android.TrommelydSensorListener.onSensorChanged(TrommelydSensorListener.java:55)
at android.hardware.SensorManager$ListenerDelegate$1.handleMessage(SensorManager.java:539)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
```