Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when calculating scroll #795

Open
takahirom opened this issue Sep 29, 2022 · 8 comments
Open

Fix crash when calculating scroll #795

takahirom opened this issue Sep 29, 2022 · 8 comments

Comments

@takahirom
Copy link
Member

Idea Description

Fatal Exception: java.lang.IllegalStateException
Offset is unspecified
androidx.compose.ui.geometry.Offset.getX-impl (Offset.java:28)
io.github.droidkaigi.confsched2022.feature.sessions.ScreenScrollState$scroll$2$1.invokeSuspend (ScreenScrollState.java:31)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (BaseContinuationImpl.java:8)
kotlinx.coroutines.DispatchedTask.run (DispatchedTask.java:100)

image

    suspend fun scroll(
        dragAmount: Offset,
        timeMillis: Long,
        position: Offset,
    ) {
        val nextPossibleX = calculatePossibleScrollX(dragAmount.x)
        val nextPossibleY = calculatePossibleScrollY(dragAmount.y)
        scrollState.scroll(
            Offset(nextPossibleX, nextPossibleY), //
value class Offset internal constructor(internal val packedValue: Long) {

    @Stable
    val x: Float
        get() {
            // Explicitly compare against packed values to avoid auto-boxing of Size.Unspecified
            check(this.packedValue != Unspecified.packedValue) {
                "Offset is unspecified" //
            }
            return unpackFloat1(packedValue)
        }

Reference images and links

@Tomoyuki-TAKEZAKI
Copy link
Contributor

I'd like to work on this issue 🙋🏻

@takahirom
Copy link
Member Author

@Tomoyuki-TAKEZAKI I'm looking forward to seeing your PR! Assigned 👍

@takahirom
Copy link
Member Author

takahirom commented Oct 7, 2022

@Tomoyuki-TAKEZAKI Sorry. Let me unassign issue due to the time🙏

@takahirom
Copy link
Member Author

image

@Tomoyuki-TAKEZAKI
Copy link
Contributor

Tomoyuki-TAKEZAKI commented Oct 7, 2022

@takahirom
I was using Flamingo instead of Android Studio Electric Eel, so the build didn't go well and I was late.
I was going to tackle it during the third-day session of DroidKaigi.
Sorry 😢

@takathemax
Copy link
Contributor

I'd like to work on this issue 🙋🏻

@takathemax
Copy link
Contributor

takathemax commented Oct 7, 2022

Oh, I see that a predecessor for this issue has returned, so I will look for another issue myself. 👍

@Tomoyuki-TAKEZAKI
Copy link
Contributor

@takahirom
I opened a PR for this issue: #878
Sorry for the late PR. 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants