FrangSierra/RxFirebase

Crash due to NPE in firebase-database

rpattabi opened this issue · 1 comments

I use firebase realtime database through rxfirebase. Occasionally I get the following crash (not on my devices, but through crashlytics).

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 
   'java.lang.String java.lang.String.toLowerCase(java.util.Locale)' on a null object reference
at com.google.firebase.database.tubesock.WebSocketHandshake.verifyServerHandshakeHeaders(com.google.firebase:firebase-database@@16.0.5:111)
at com.google.firebase.database.tubesock.WebSocket.runReader(com.google.firebase:firebase-database@@16.0.5:418)
at com.google.firebase.database.tubesock.WebSocket.access$000(com.google.firebase:firebase-database@@16.0.5:47)
at com.google.firebase.database.tubesock.WebSocket$2.run(com.google.firebase:firebase-database@@16.0.5:143)
at java.lang.Thread.run(Thread.java:818)

Rx just prevent you to have null items(Snapshots in this case), but the data inside the Snapshot could be always null, you should take care of it manually, if you want to use RX use a filter before a map, or you could suffer NPE. It's not a library problem.