AnsweredAssumed Answered

Asmack android 4.0.5 null pointer exception while removing listeners

Question asked by Emmanouil on Dec 4, 2014
Latest reply on Dec 6, 2014 by Flow

When I try to remove my listeners from the connection I receive a null pointer exception.

Although my connection instance is not null (and seems that the connection has been initialized), it is as if the inner list of packetlisteners is null (therefore it is not initialized).

 

The stacktrace is

 

java.lang.NullPointerException

at java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:921)

at org.jivesoftware.smack.XMPPConnection.removePacketListener(XMPPConnection.java: 857)

at com.taxiplon.taxi.driver.TaxiMapGoogle.removeListeners(TaxiMapGoogle.java:1919)

at com.taxiplon.taxi.driver.TaxiMapGoogle.quit(TaxiMapGoogle.java:2996)

at com.taxiplon.taxi.driver.TaxiMapGoogle$30.onClick(TaxiMapGoogle.java:2985)

at android.view.View.performClick(View.java:4222)

at android.view.View$PerformClick.run(View.java:17337)

at android.os.Handler.handleCallback(Handler.java:615)

at android.os.Handler.dispatchMessage(Handler.java:92)

at android.os.Looper.loop(Looper.java:137)

at android.app.ActivityThread.main(ActivityThread.java:4895)

at java.lang.reflect.Method.invokeNative(Native Method)

at java.lang.reflect.Method.invoke(Method.java:511)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)

at dalvik.system.NativeStart.main(Native Method)

Outcomes