当我尝试调用child.getPriority()
并将其转换为应该已经插入优先级为ServerValue.TIMESTAMP
的子项的double时,我遇到了崩溃。事实上,我几乎可以肯定,我从不插入没有优先权的项目,但我仍然遇到这种崩溃。
java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference
at com.myapp.android.core.MyService$QueueListener.onDataChange(MyService.java:688)
at com.firebase.client.core.ValueEventRegistration.fireEvent(ValueEventRegistration.java:42)
at com.firebase.client.core.view.DataEvent.fire(DataEvent.java:45)
at com.firebase.client.core.view.EventRaiser$1.run(EventRaiser.java:38)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)