[Crashlytics][2.4] AgePickerDialog NumberFormatException on empty input when tapping OK, still crashing in 2.3 (118 events / 61 users in 30 days)

XMLWordPrintable

      Summary

      AgePickerDialog crashes with NumberFormatException (For input string: "") when the OK button is tapped after the picker text was cleared. The crash still occurs in release 2.3. Fix is required in 2.4.

      Background / Context

      • Source: Firebase Crashlytics, project stoptb-8e404, app org.piramalswasthya.stoptb, 30-day crash view (Oct 12 – Nov 10, 2026).
      • Existing ticket: STOP-783 (RCA-03, Medium, fix version 2.5). This ticket tracks the 2.4 fix. Priority is set to High because this is the age-picker crash with the most events (118) and affects 61 users in the new beneficiary registration flow.

      Problem Statement

      Tapping OK in the age dialog after clearing a picker's text field makes the app crash.

      Current Behaviour (Actual)

      • Crash: java.lang.NumberFormatException - For input string: "" at AgePickerDialog.kt:97 (AgePickerDialog.show$lambda$5$lambda$3), in the new_ben_registration screen.
      • 118 events / 61 users in 30 days. Affected versions: 1.1.3 – 2.3.
      • RCA-03 (Probable Root Cause, not reproduced on device): the OK handler calls String.toInt() directly on the picker's inner EditText text for years, months and days, with no handling for empty or invalid input. On release-2.2.3 the toInt() calls are at lines 122/127/132, while the crash trace says line 97, so the shipped build may differ from the branch analysed.

      Expected Behaviour / Requirement

      • Tapping OK never crashes, whatever the content of the Years, Months and Days fields.
      • Behaviour for an empty field (default value, clamp, or validation message) is [TBD/CLARIFICATION REQUIRED]. CAPA-09 proposes toIntOrNull() with a default/clamp.

      User Story

      As a health worker registering a beneficiary, I want the age dialog to handle empty or edited values safely, so that I do not lose the registration I am filling in.

      Acceptance Criteria

      • Given the age dialog is open, When I clear the Years, Months or Days field and tap OK, Then the app does not crash.
      • Given an empty field, When I tap OK, Then the dialog applies the agreed behaviour. [TBD/CLARIFICATION REQUIRED]
      • Given the 2.4 build is released, When Crashlytics is checked, Then this issue shows no new events on 2.4.

      Business Rules / Validations

      • Valid ranges for Years, Months and Days: [TBD/CLARIFICATION REQUIRED]

      Dependencies

      • Related: STOP-783 (RCA-03). Sibling issue: STOP-787 (AgePicker ArrayIndexOutOfBoundsException), both in AgePickerDialog.

      Impact / Affected Areas

      • AgePickerDialog and new beneficiary registration (new_ben_registration).

      Out of Scope

      • The Days picker ArrayIndexOutOfBoundsException (STOP-787).

      QA / Testing Considerations

      • Clear each field (Years, Months, Days) and tap OK; confirm no crash (CAPA-09 validation).
      • Verify against the shipped build, since line numbers in the crash trace differ from the analysed branch.
      • Verify in Crashlytics after the 2.4 rollout.

       

              Assignee:
              Shivani Garg
              Reporter:
              Shivani Garg
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: