LucasGGamerM / moshidon

Better modification of the official Mastodon for Android app
https://LucasGGamerM.github.io/moshidon/
GNU General Public License v3.0
648 stars 31 forks source link

Crashing when opening unsent posts #318

Closed zeddiq closed 10 months ago

zeddiq commented 10 months ago

Describe the bug

I saved a draft post with an mp3 file attached. Now, when I try to open my unsent posts to see my drafts, Moshidon crashes

To reproduce

Steps to reproduce the behavior:

  1. Create a new post
  2. Attach an mp3 file
  3. Save the post as a draft
  4. Open Unsent Posts and it'll crash

Does this happen in the official app?

Does this issue also occur with the respective upstream release?

No because the official app doesn't support drafts

Version

Moshidon version: v2.1.4+fork.103.moshinda (103)

Crash log

2.1.4+fork.103.moshinda (103) 2023-12-17T18:45:07.452Z

java.lang.NullPointerException: Attempt to read from field 'java.lang.String org.joinmastodon.android.model.Account.avatarStatic' on a null object reference in method 'void org.joinmastodon.android.ui.displayitems.AudioStatusDisplayItem.(java.lang.String, org.joinmastodon.android.fragments.BaseStatusListFragment, org.joinmastodon.android.model.Status, org.joinmastodon.android.model.Attachment)' at org.joinmastodon.android.ui.displayitems.AudioStatusDisplayItem.(AudioStatusDisplayItem.java:42) at org.joinmastodon.android.ui.displayitems.StatusDisplayItem.buildItems(StatusDisplayItem.java:297) at org.joinmastodon.android.fragments.ScheduledStatusListFragment.buildDisplayItems(ScheduledStatusListFragment.java:88) at org.joinmastodon.android.fragments.ScheduledStatusListFragment.buildDisplayItems(ScheduledStatusListFragment.java:35) at org.joinmastodon.android.fragments.BaseStatusListFragment.onAppendItems(BaseStatusListFragment.java:146) at me.grishka.appkit.utils.Preloader.onDataLoaded(Preloader.java:90) at me.grishka.appkit.fragments.BaseRecyclerFragment.onDataLoaded(BaseRecyclerFragment.java:327) at org.joinmastodon.android.fragments.BaseStatusListFragment.onDataLoaded(BaseStatusListFragment.java:1055) at org.joinmastodon.android.fragments.ScheduledStatusListFragment$1.onSuccess(ScheduledStatusListFragment.java:143) at org.joinmastodon.android.fragments.ScheduledStatusListFragment$1.onSuccess(ScheduledStatusListFragment.java:135) at me.grishka.appkit.api.APIRequest$1.run(APIRequest.java:29) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7918) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

LucasGGamerM commented 10 months ago

Hmmm, I took a look at it and it seems like it would only happen if your avatar picture is nonexistent, which is why I couldn't reproduce this at the moment. Can you confirm your profile picture is nonexistent and the audio file does not contain a cover?

zeddiq commented 10 months ago

the audio file does not have a cover but I do have a profile picture

LucasGGamerM commented 10 months ago

Strange. It should have loaded your profile picture in that case. Can you try reproducing it again with another scheduled post?

zeddiq commented 10 months ago

Trying to schedule any post is causing Moshidon to crash, regardless of if the post contains an mp3 file or not. Saving as a draft without scheduling seemingly works fine (I obviously can't check my drafts to see if it actually worked, but the app doesn't crash when I do that)

LucasGGamerM commented 10 months ago

Is the crash log the same? This is a weird problem

zeddiq commented 10 months ago

It does appear to be different; here's my most recent crash log:

2.1.4+fork.103.moshinda (103) 2023-12-17T19:29:27.437Z

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setEnabled(boolean)' on a null object reference at org.joinmastodon.android.fragments.ComposeFragment.actuallyPublish(ComposeFragment.java:1296) at org.joinmastodon.android.fragments.ComposeFragment.lambda$publish$31(ComposeFragment.java:1166) at org.joinmastodon.android.fragments.ComposeFragment.$r8$lambda$rcVMocXj42fGJXk_cUsgCzUzeX4(ComposeFragment.java:0) at org.joinmastodon.android.fragments.ComposeFragment$$ExternalSyntheticLambda32.run(R8$$SyntheticClass:0) at org.joinmastodon.android.ui.viewcontrollers.ComposeMediaViewController.saveAltTextsBeforePublishing(ComposeMediaViewController.java:639) at org.joinmastodon.android.fragments.ComposeFragment.publish(ComposeFragment.java:1165) at org.joinmastodon.android.fragments.ComposeFragment.publish(ComposeFragment.java:1148) at org.joinmastodon.android.fragments.ComposeFragment.checkAltTextsAndPublish(ComposeFragment.java:1128) at org.joinmastodon.android.fragments.ComposeFragment.lambda$onCreateOptionsMenu$25(ComposeFragment.java:928) at org.joinmastodon.android.fragments.ComposeFragment.$r8$lambda$rdaIu61Si9uzfi6uIcc9aKi5-wA(ComposeFragment.java:0) at org.joinmastodon.android.fragments.ComposeFragment$$ExternalSyntheticLambda47.accept(R8$$SyntheticClass:0) at org.joinmastodon.android.fragments.ComposeFragment.lambda$onCreateOptionsMenu$28(ComposeFragment.java:944) at org.joinmastodon.android.fragments.ComposeFragment.$r8$lambda$XhWAJ6M9tfUbNdRk7rz0GxgeUQQ(ComposeFragment.java:0) at org.joinmastodon.android.fragments.ComposeFragment$$ExternalSyntheticLambda10.onClick(R8$$SyntheticClass:0) at android.view.View.performClick(View.java:7542) at android.view.View.performClickInternal(View.java:7519) at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0) at android.view.View$PerformClick.run(View.java:29476) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7918) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

LucasGGamerM commented 10 months ago

Mkay, I have diagnosed the last crash, and fixed it in 6220a20734fb6a04ced32fc84c0b12c43edd7f1f, which means we gotta wait a bit for the nightly build to build and you can test it again to see if it crashes in the latest situation.

I will ping you once the build is ready

LucasGGamerM commented 10 months ago

Its ready at https://nightly.link/LucasGGamerM/moshidon/workflows/nightly-builds/master/moshidon-nightly.apk.zip

Can you please download it and try to see if that fixed at least one of the issues you mentioned?

zeddiq commented 10 months ago

This version fixes the crash when trying to schedule a post, and the crash when opening unsent posts remains

LucasGGamerM commented 10 months ago

Okay, I am fixing that here real quick

LucasGGamerM commented 10 months ago

I bodged up something here, hopefully that fixes it.

I will ping you once a new nightly is ready for you to try out!

LucasGGamerM commented 10 months ago

Yaaaaaaaa it's ready! Please download it at https://nightly.link/LucasGGamerM/moshidon/workflows/nightly-builds/master/moshidon-nightly.apk.zip to see if the crash still happens

zeddiq commented 10 months ago

still happening, here's the crash log:

2.1.4+fork.103.moshinda-nightly+@2023-12-17 (103) 2023-12-17T20:15:49.791Z

java.lang.NullPointerException: Attempt to read from field 'java.lang.String org.joinmastodon.android.model.Account.avatarStatic' on a null object reference in method 'void org.joinmastodon.android.ui.displayitems.AudioStatusDisplayItem.(java.lang.String, org.joinmastodon.android.fragments.BaseStatusListFragment, org.joinmastodon.android.model.Status, org.joinmastodon.android.model.Attachment)' at org.joinmastodon.android.ui.displayitems.AudioStatusDisplayItem.(AudioStatusDisplayItem.java:42) at org.joinmastodon.android.ui.displayitems.StatusDisplayItem.buildItems(StatusDisplayItem.java:297) at org.joinmastodon.android.fragments.ScheduledStatusListFragment.buildDisplayItems(ScheduledStatusListFragment.java:88) at org.joinmastodon.android.fragments.ScheduledStatusListFragment.buildDisplayItems(ScheduledStatusListFragment.java:35) at org.joinmastodon.android.fragments.BaseStatusListFragment.onAppendItems(BaseStatusListFragment.java:146) at me.grishka.appkit.utils.Preloader.onDataLoaded(Preloader.java:90) at me.grishka.appkit.fragments.BaseRecyclerFragment.onDataLoaded(BaseRecyclerFragment.java:327) at org.joinmastodon.android.fragments.BaseStatusListFragment.onDataLoaded(BaseStatusListFragment.java:1055) at org.joinmastodon.android.fragments.ScheduledStatusListFragment$1.onSuccess(ScheduledStatusListFragment.java:143) at org.joinmastodon.android.fragments.ScheduledStatusListFragment$1.onSuccess(ScheduledStatusListFragment.java:135) at me.grishka.appkit.api.APIRequest$1.run(APIRequest.java:29) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7918) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

LucasGGamerM commented 10 months ago

Mkay, makes sense as well. I am patching the fix here and now it should work!

LucasGGamerM commented 10 months ago

Mkay, now it should work. Let's wait for another nightly build!

LucasGGamerM commented 10 months ago

Its done again! Lets hope this one fixes it for good this time :D

https://nightly.link/LucasGGamerM/moshidon/workflows/nightly-builds/master/moshidon-nightly.apk.zip

zeddiq commented 10 months ago

it works! thank you so much :)

LucasGGamerM commented 10 months ago

it works! thank you so much :)

Ayyyyy Github Issue speedrun 100% glitchless Personal Best achieved!