crisp-im / crisp-sdk-android

:package: Crisp Android SDK, add a chat in any Android app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/android-sdk/
Other
55 stars 17 forks source link

getting NullPointerException in production app #126

Closed osman-teamswork closed 1 year ago

osman-teamswork commented 1 year ago

Here is the crashlytics log of my production app. Please check this.

Device details- Brand: samsung Model: Galaxy A22 5G OS Version: Android 11

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String im.crisp.client.internal.i.a.f()' on a null object reference
       at im.crisp.client.internal.t.b.a(:10)
       at im.crisp.client.internal.j.a.a(:22)
       at im.crisp.client.internal.j.a.onPostExecute(:2)
       at android.os.AsyncTask.finish(AsyncTask.java:771)
       at android.os.AsyncTask.access$900(AsyncTask.java:199)
       at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8653)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Doc1faux commented 1 year ago

Hello @osman-teamswork and thank you for your feedback.

Could you please precise me which version of the Crisp Android SDK you're using to enable me symbolicate your stacktrace?

Thanks in advance :)

osman-teamswork commented 1 year ago

@Doc1faux I am using SDK version - 1.0.12

Doc1faux commented 1 year ago

Thank you @osman-teamswork for your clarification.

After a deep dive, I found this crash could happen if an attachment upload was successful but in the meanwhile the upload data (needed to create the message containing the attachment) has been wiped out by a call to resetChatSession when the socket was disconnected or if the socket emits an invalid session error...

In both cases, the session is cleared (including upload data) and has to be recreated so I fixed it by failing with a "server" error inviting the user to re-upload its file.

The fix will be available in the next 1.0.13 release.

Doc1faux commented 1 year ago

@osman-teamswork 1.0.13 fixing this issue has just been released. It can take a few hours before it will be available. I close the issue.