Description
What is the issue?
A NullPointerException is occurring within the PresenceChannelImpl implementation when extracting presence data from a received message. This is causing our app to crash for quite a few users. I will need to somehow find a way to catch this error to avoid the app crashing in the short-term.
Is it a crash report? Submit stack traces or anything that you think would help
Here is the stack trace from our error reporting:
Fatal Exception: java.lang.NullPointerException
throw with null exception
com.pusher.client.channel.impl.PresenceChannelImpl.handleSubscriptionSuccessfulMessage (PresenceChannelImpl.java:101)
com.pusher.client.channel.impl.PresenceChannelImpl.onMessage (PresenceChannelImpl.java:58)
com.pusher.client.channel.impl.ChannelManager.onMessage (ChannelManager.java:116)
com.pusher.client.connection.websocket.WebSocketConnection.handleEvent (WebSocketConnection.java:177)
com.pusher.client.connection.websocket.WebSocketConnection.access$600 (WebSocketConnection.java:27)
com.pusher.client.connection.websocket.WebSocketConnection$6.run (WebSocketConnection.java:261)
com.pusher.client.util.Factory$1.run (Factory.java:119)
In onMessage
when the message is a subscription success, it tries to extract the presence data from the event. This data seems to come back as null, but the code isn't handling that case and so a NullPointerException is thrown.
PresenceChannelImpl.java
private void handleSubscriptionSuccessfulMessage(final String message) {
// extract data from the JSON message
final PresenceData presenceData = extractPresenceDataFrom(message);
Line 101. CRASH HERE ---> final List<String> ids = presenceData.ids;
Any improvements you suggest
Only improvement is to not crash.
Let me know if you need more information, although not sure what else I can see, due to the whole stack-trace being entirely within Pusher code and being when subscription succeeds, as opposed to a message triggered by the app.
CC @pusher/mobile