We are getting the following exception in our app.
Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method ‘long org.jivesoftware.smack.XMPPConnection.getPacketReplyTimeout()’ on a null object reference
at org.jivesoftware.smackx.ping.PingManager.pingMyServer(Unknown Source)
at org.jivesoftware.smackx.ping.PingManager.pingServerIfNecessary(Unknown Source)
at org.jivesoftware.smackx.ping.android.ServerPingWithAlarmManager$2$1.run(Unknown Source)
If the connection is broken we will clear the connection and try to make a new one. And as the connection held in PingManager is a weak reference, it seemed that the reference to connection is becoming null and thus the exception occurred in pingMyServer when doing the retry.
Can anyone advise us how to handle the situation in a better way? Thanks in advance.