TymanWasTaken / aliucord-plugins

Other
19 stars 6 forks source link

Translation fails for messages with abnormal message lengths #6

Open koxx12-dev opened 2 years ago

koxx12-dev commented 2 years ago

Log:

[Aliucord] [Patcher] Exception while hooking com.discord.widgets.chat.list.adapter.WidgetChatListAdapterItemMessage.processMessageText
java.lang.IndexOutOfBoundsException: replace (0 ... 42) ends beyond length 21
  at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1325)
  at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:513)
  at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:507)
  at com.aliucord.plugins.Translate.setTranslated(Translate.kt:109)
  at com.aliucord.plugins.Translate.patchProcessMessageText$lambda-3(Translate.kt:137)
  at com.aliucord.plugins.Translate.$r8$lambda$PJ-ULxBEcCzGH0BHOq7sJn3EjTc(Unknown Source:0)
  at com.aliucord.plugins.Translate$$ExternalSyntheticLambda4.call(Unknown Source:6)
  at com.aliucord.patcher.PinePatchFn.afterCall(PinePatchFn.kt:21)
  at top.canyie.pine.Pine.handleCall(Pine.java:528)
  at top.canyie.pine.entry.Arm64Entry.handleBridge(Arm64Entry.java:159)
  at top.canyie.pine.entry.Arm64Entry.voidBridge(Arm64Entry.java:24)
  at com.discord.widgets.chat.list.adapter.WidgetChatListAdapterItemMessage.onConfigure(WidgetChatListAdapterItemMessage.kt, [Aliucord] [Patcher] Exception while hooking com.discord.widgets.chat.list.adapter.WidgetChatListAdapterItemMessage.processMessageText:20)
TymanWasTaken commented 2 years ago

I am aware of this issue, it also happens with mentions, I will attempt to fix it when I have time

VioletStorm commented 1 year ago

This is still happening for me I believe, I had a moderately sized message fail to translate