Port v6: Fix reactions modal crash when no reactions can be displayed#6476
Conversation
…list crash
UserReactionsView.bindReactionList set GridLayoutManager.spanCount directly
from the size of the filtered reaction list. When the filter produces an
empty list (e.g. reactions whose user is null, or whose type has no
registered drawable in ChatUI.supportedReactions), spanCount = 0 was passed
to GridLayoutManager.setSpanCount, which rejects it with
IllegalArgumentException("Span count should be at least 1. Provided 0").
Coerce the value to at least 1. spanCount = 1 on an empty RecyclerView is
harmless; the modal opens with an empty grid instead of crashing.
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
Walkthrough
ChangesUser Reactions Grid Layout Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
SDK Size Comparison 📏
|
|



Port of #6475 to v7 (develop).
Closes AND-1194.
Goal
Fix the
IllegalArgumentException: Span count should be at least 1. Provided 0crash fromUserReactionsView.bindReactionListwhen the reactions modal opens on a message whose filteredlatestReactionsends up empty. The same buggy code is present on every v6 release from 6.35.0 through 6.38.0 and ondevelop.Implementation
UserReactionsView.bindReactionListsetgridLayoutManager.spanCountdirectly from the size of the filtered reaction list:When
userReactionItemsis empty,spanCount = 0is passed toGridLayoutManager.setSpanCount, which rejects it.Clamp the value to at least 1:
./gradlew apiDumpproduced zero.apidiff, confirming no public surface change.Testing
See #6475 for the manual repro patch and full testing notes. Also verified on this branch:
./gradlew spotlessApply detekt apiDump— clean.Summary by CodeRabbit