Skip to content

[Bug] Prevent NullPointerException crash in KYC Level 1 DOB confirmation flow #2021

Description

@ayuxsh009

Description

The KYC Level 1 screen can crash with a NullPointerException while confirming the date of birth selection.

In KYCLevel1Screen.kt, the confirm button directly uses a non-null assertion on dateState.selectedDateMillis:

onAction(KycLevel1Action.DobChanged(dateState.selectedDateMillis!!))

Although the button is enabled only when a date is selected, the enabled state and click handler access the state separately. During rapid taps, recomposition, or AnimatedVisibility transitions, selectedDateMillis may temporarily become null between these reads, resulting in a crash.

Location

feature/kyc/src/commonMain/kotlin/org/mifospay/feature/kyc/KYCLevel1Screen.kt

Steps to Reproduce

  1. Navigate to the KYC Level 1 screen
  2. Open the date of birth picker
  3. Rapidly tap OK or interact with the picker during animation/recomposition

Expected Behavior

The selected date should be safely processed, or the action should be ignored if no valid date is available.

Actual Behavior

The application crashes with a NullPointerException caused by selectedDateMillis!!.

Platform

  • Android
  • Kotlin Multiplatform (affects all platforms using this composable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions