Skip to content

Getting crash - Attempt to invoke virtual method addMessageStatusListener on a null object reference #67

@AnandKuhar1100

Description

@AnandKuhar1100

Logs -
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.quickblox.chat.QBMessageStatusesManager.addMessageStatusListener(com.quickblox.chat.listeners.QBMessageStatusListener)' on a null object reference
at com.quickblox.reactnative.chat.ChatModule.addMessageStatusListener(ChatModule.java:125)
at com.quickblox.reactnative.chat.ChatModule.access$700(ChatModule.java:58)
at com.quickblox.reactnative.chat.ChatModule$1.onSuccess(ChatModule.java:208)
at com.quickblox.reactnative.chat.ChatModule$1.onSuccess(ChatModule.java:202)
at com.quickblox.core.helper.CommonUtils.notifyEntityCallbackOnSuccess(:2)
at com.quickblox.chat.QBChatService$4.run(:5)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:226)
at android.app.ActivityThread.main(ActivityThread.java:7592)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

We are getting this crash. I checked native android files for quickblox-react-native-sdk and figure out that addMessageStatusListener is fired when connect (inside ChatModule.java) method returns success.
Inside addMessageStatusListener method we are using QBMessageStatusesManager instance. We are getting this instance as null.
This can be null only if this.connection (Inside QBChatServices.class) is not connected or not authenticated. We are connecting and authenticating user inside login method in QBChatService.class. May be either connection is not successful or user is not authenticated and "connect" method returns success and we are getting crash. Please help in resolving this crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions