[Crashlytics] AgePickerDialog crashes with NumberFormatException on empty input when tapping OK (11 events)

XMLWordPrintable

    • STOP TB Sprint 12

      Summary

      NumberFormatException (For input string "") in the AgePicker dialog when the user clears a picker text field and taps OK.

      Background / Context

      Source: StopTB Android Crashlytics RCA (Oct 15–21 2026, release 2.2.3). RCA ref RCA-03, status: Probable Root Cause. Priority: P2. 11 events / 7 users, first seen 1.1.3, still occurring in 2.2.3. Evidence: code only.

      Problem Statement

      The OK handler reads the picker's inner EditText text directly for years, months and days and parses it with toInt(); the picker allows empty text after manual edits.

      Current Behaviour (Actual)

      • User clears the picker's text field and taps OK → String.toInt() on an empty value throws.
      • No empty/invalid input handling in the OK click handler.
      • Crash trace points to AgePickerDialog.kt:97, but in release-2.2.3 the toInt() calls are at lines 122/127/132; the shipped build may differ.

      Expected Behaviour / Requirement

      Clearing a field and tapping OK must not crash. Resulting value for an empty field (default vs clamp) is [TBD/CLARIFICATION REQUIRED].

      User Story

      As a field user entering an age, I want an accidental empty field to be handled gracefully, so that the app does not crash when I tap OK.

      Acceptance Criteria

      • Given the age dialog, When the user clears each of the years, months and days fields and taps OK, Then the app does not crash (CAPA-09).
      • Given an empty or invalid value, When OK is tapped, Then parsing uses toIntOrNull() with a default/clamp for years, months and days.

      Business Rules / Validations

      Default/clamp value for empty input: [TBD/CLARIFICATION REQUIRED] (e.g. whether empty = 0 or previous value).

      Dependencies

      None. Related to RCA-02 ticket (same dialog).

      Impact / Affected Areas

      AgePickerDialog.kt OK handler (lines 122/127/132 on release-2.2.3); all forms using the age picker.

      Out of Scope

      Days picker array-bounds crash (separate ticket for RCA-02).

      QA / Testing Considerations

      Clear each field individually and together, tap OK; verify saved age value is as per agreed default; verify no new NumberFormatException events after release.

      Open Questions / Clarifications

      • What value should an empty field resolve to (0, previous value, minimum)?
      • Confirm line numbers against the shipped 2.2.3 build.

      Source: StopTB_Crashlytics_RCA.xlsx (RCA-03, CAPA-09).

              Assignee:
              Deepak Kumar
              Reporter:
              Shivani Garg
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: