Commit 8b4051d
fix(chat): avoid ClassCastException when building FileParameters
ChatMessageUi.messageParameters is built via Kotlin's toMap(), which
returns a Collections.SingletonMap for a single entry instead of a
HashMap. Both call sites unsafely cast it to
HashMap<String?, HashMap<String?, String?>>?, which crashes whenever a
message has exactly one rich-object parameter (e.g. a plain file
share) - the common case for FileParameters.
Build real HashMap instances from messageParameters instead of casting
it. Also removes a runCatching block in
LazyListState.visibleItemsWithThreshold() that silently swallowed the
same ClassCastException, which was hiding this bug and causing file id
lookups to fail there.
fixed crash:
❯ 2026-08-07 12:02:40.777 28629-28629 NextcloudT...pplication com.nextcloud.talk2 E Uncaught exception in thread "main" (Fix with AI)
java.lang.ClassCastException: java.util.Collections$SingletonMap cannot be cast to
java.util.HashMap
at com.nextcloud.talk.ui.chat.MediaMessageKt.MediaMessage(MediaMessage.kt:71)
at
com.nextcloud.talk.ui.chat.ChatMessageViewKt.ChatMessageView$lambda$5$1(ChatMessageView.kt:151)
at
com.nextcloud.talk.ui.chat.ChatMessageViewKt.$r8$lambda$BiaHdWRFag7qJIfvY45CugWWbIY(ChatMessageView.kt:0)
at
com.nextcloud.talk.ui.chat.ChatMessageViewKt$$ExternalSyntheticLambda1.invoke(D8$$SyntheticClass:0)
at
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:122)
at
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:52)
at
com.nextcloud.talk.ui.chat.SwipeToReplyContainerKt.SwipeToReplyContainer(SwipeToReplyContainer.kt:57)
at
com.nextcloud.talk.ui.chat.ChatMessageViewKt.ChatMessageView$lambda$5(ChatMessageView.kt:114)
at
com.nextcloud.talk.ui.chat.ChatMessageViewKt$$ExternalSyntheticLambda4.invoke(D8$$SyntheticClass:0)
at
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:122)
at
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:52)
at
androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:408)
at
com.nextcloud.talk.ui.chat.ChatMessageViewKt.ChatMessageView(ChatMessageView.kt:105)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>1 parent 812f400 commit 8b4051d
2 files changed
Lines changed: 12 additions & 11 deletions
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1001 | 1001 | | |
1002 | 1002 | | |
1003 | 1003 | | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
1014 | 1009 | | |
1015 | 1010 | | |
1016 | 1011 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
| |||
0 commit comments