Skip to content

[carousel] crash on arrangement null reference #3634

@nijuyonkadesu

Description

@nijuyonkadesu

Description: I have list of images displayed in Carousel. Once navigated to a (settings) fragment, and comming back to main Carousel, my app crashes. When I looked at stacktrace I got: https://bin.utwitch.net/zodineqadi.apache

after onResume() callback, app crashes.
I was hopelessly searching on how to use SavedStateHandle to fix this and found:
(I absolutely do not understand this code, but it was odd to my eyes)
image_2023-10-15_23-07-55

Expected behavior: Carousel page should resume and show images from where it was before navigation action.

Source code: fragment_carousel.xml, CarouselFragment.kt, nav_graph.xml
but remove these two to reproduce the issue

app:launchSingleTop="true"
app:popUpTo="@id/nav_graph"

Minimal sample app repro: https://github.com/nijuyonkadesu/SAO/tree/settings

Android API version: 33

Material Library version:

recycler-view = "1.3.1"
m3 = "1.10.0"
nav = "2.7.4"

Device: Redmi Note 11 [MIUI - Android 12], Redmi Note 9 Pro [Android 13 - Custom ROM]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions