deltachat / deltachat-android

Email-based instant messaging for Android.
GNU General Public License v3.0
1.09k stars 144 forks source link

App crashes when a chat with Webxdc is opened. #2516

Closed link2xt closed 1 year ago

link2xt commented 1 year ago

I have a chat with webxdc which crashes every time I scroll the chat to the preview of webxdc on Android:

03-26 19:56:09.654 28654 28654 E AndroidRuntime: FATAL EXCEPTION: main
03-26 19:56:09.654 28654 28654 E AndroidRuntime: Process: com.b44t.messenger.beta, PID: 28654
03-26 19:56:09.654 28654 28654 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'org.json.JSONObject com.b44t.messenger.DcMsg.getWebxdcInfo()' on a null object reference                                                                                                                   
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at org.thoughtcrime.securesms.ConversationUpdateItem.setGenericInfoRecord(ConversationUpdateItem.java:93)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at org.thoughtcrime.securesms.ConversationUpdateItem.bind(ConversationUpdateItem.java:67)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at org.thoughtcrime.securesms.ConversationAdapter.onBindViewHolder(ConversationAdapter.java:247)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7065)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7107)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6012)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6279)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:883)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:100)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:214)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7397)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
03-26 19:56:09.654 28654 28654 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:920)
03-26 19:56:09.658  1468 10009 W ActivityTaskManager:   Force finishing activity com.b44t.messenger.beta/org.thoughtcrime.securesms.ConversationActivity
03-26 19:56:09.658  6322 11637 D AlarmSleepTimer: Setting an exact alarm to wake up in 30000ms.
03-26 19:56:09.662  1468 12977 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
03-26 19:56:09.668  1468 10009 D ActivityTrigger: ActivityTrigger activityPauseTrigger

webxdc itself is ok, it even opens on Desktop. But maybe it was received in a different way on Android or failed to write the blob to the database.

WofWca commented 1 year ago

The .xdc file itself.

vikunja.zip

link2xt commented 1 year ago

Looks like a related PR that introduced the code which fails here: #2503

link2xt commented 1 year ago

I made a fix #2517 and tested that it works, discussion is in the PR.

link2xt commented 1 year ago

Fixed in https://github.com/deltachat/deltachat-android/commit/e55eb9ba8ea912b00ba35e12c7ca1b31240ba143