LucasGGamerM / moshidon

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

Crash when voting on a poll with a content warning #380

Open NicoCharrua opened 3 months ago

NicoCharrua commented 3 months ago

Describe the bug

If a poll has a content warning, voting sometimes crashes the app. I only noticed this while voting in a feed (and not after the post was opened), but that could be a coincidence.

To reproduce

  1. Open content warning
  2. Select an option
  3. Vote
  4. See crash

Version

Moshidon version: 2.2.4+fork.104.moshinda-nightly+@2024-04-18 org.joinmastodon.android.moshinda.nightly

Crash log

2.2.4+fork.104.moshinda-nightly+@2024-04-18 (104) 2024-04-19T20:22:23.622Z

java.lang.RuntimeException: Could not dispatch event: class org.joinmastodon.android.events.PollUpdatedEvent to handler [EventHandler public void org.joinmastodon.android.fragments.StatusListFragment$EventListener.onPollUpdated(org.joinmastodon.android.events.PollUpdatedEvent)]: toIndex = 167 at com.squareup.otto.Bus.throwRuntimeException(Bus.java:460) at com.squareup.otto.Bus.dispatch(Bus.java:387) at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:368) at com.squareup.otto.Bus.post(Bus.java:337) at com.squareup.otto.AsyncBus.post(AsyncBus.java:56) at org.joinmastodon.android.E.post(E.java:12) at org.joinmastodon.android.fragments.BaseStatusListFragment$5.onSuccess(BaseStatusListFragment.java:681) at org.joinmastodon.android.fragments.BaseStatusListFragment$5.onSuccess(BaseStatusListFragment.java:678) at me.grishka.appkit.api.APIRequest$1.run(APIRequest.java:29) at android.os.Handler.handleCallback(Handler.java:959) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8501) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878) Caused by: java.lang.IndexOutOfBoundsException: toIndex = 167 at java.util.AbstractList.subListRangeCheck(AbstractList.java:507) at java.util.ArrayList.subList(ArrayList.java:1125) at org.joinmastodon.android.fragments.BaseStatusListFragment.updatePoll(BaseStatusListFragment.java:608) at org.joinmastodon.android.fragments.StatusListFragment$EventListener.onPollUpdated(StatusListFragment.java:393) at java.lang.reflect.Method.invoke(Native Method) at com.squareup.otto.EventHandler.handleEvent(EventHandler.java:89) at com.squareup.otto.Bus.dispatch(Bus.java:385) ... 15 more

LucasGGamerM commented 2 months ago

Do you have any more info as for how you can get this to happen? The issue itself shouldn't even be possible, but it somehow happens. If you could provide more info it'd be much appreciated

NicoCharrua commented 2 months ago

I have a timeline that looks like this

Screenshot

Opening a CW and voting makes it happen, after I click vote.

The crash doesn't happen all of the time, and polls with cws are pretty rare anyway, so the crash rarely happens.

Whether it crashes or not seems to be random, and I was never able to record it happening.

There's a similar bug (not crash) with voting in search results. If you search for has:poll, voting on a poll doesn't show the results.

https://github.com/LucasGGamerM/moshidon/assets/55714525/28ba148b-81e9-499c-96a3-b0dce9273e87

I'm sorry I don't have any more info. If it happens again I'll get the crash log and a link to the post where it happened. Thank you

LucasGGamerM commented 2 months ago

It's alright. This is just a weird issue to happen

NicoCharrua commented 2 months ago

I just got the crash again, it was this post:

https://botsin.space/users/pollbot/statuses/112325455117950107

I clicked on a link to the post, opened the cw, voted, and it crashed. That means this doesn't only happen in feeds.

Screenshot of the crash log

This is the post that took me to the poll, if that's relevant.

https://makai.chaotic.ninja/notes/9sh69db29c

NicoCharrua commented 2 months ago

Happened again. This time I clicked into the post before revealing the content warning or posting, and it crashed.

https://botsin.space/@pollbot/112326941872008952

Screenshot of crashlog

I also got a screen recording this time. Video ends when app crashes.

https://github.com/LucasGGamerM/moshidon/assets/55714525/17f2ed0f-7feb-49b3-89b7-d8fcb4feebbf

The vote goes through, by the way.

LucasGGamerM commented 2 months ago

Weirdly enough I just cannot reproduce this

Laxystem commented 1 month ago

Can confirm, CW isn't necessary though