-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
While testing the developer settings interface, I encountered a crash caused by entering a non-numeric string in the Tabs configuration screen.
This occurred because the input field accepts full keyboard input (including letters), and when a user accidentally types a non-digit character (e.g., "12w"), the app crashes due to an unhandled NumberFormatException
. In typical UX flows, such scenarios would ideally be caught by input validation or result in a friendly user message.
While this feature is in the developer settings, accidental non-numeric input is quite easy when a full keyboard is shown. This can result in unexpected crashes that affect the user experience. Implementing a simple input validation would likely resolve the issue efficiently.
stack trace:
FATAL EXCEPTION: main
Process: com.duckduckgo.mobile.android.debug, PID: 10180
java.lang.NumberFormatException: For input string: "12w"
at java.lang.Integer.parseInt(Integer.java:797)
at java.lang.Integer.parseInt(Integer.java:915)
at com.duckduckgo.app.dev.settings.tabs.DevTabsActivity.onCreate$lambda$0(DevTabsActivity.kt:54)
at com.duckduckgo.app.dev.settings.tabs.DevTabsActivity.$r8$lambda$za8548hGpMFoYBlxbLjq6xdk8Y0(Unknown Source:0)
at com.duckduckgo.app.dev.settings.tabs.DevTabsActivity$$ExternalSyntheticLambda1.onClick(D8$$SyntheticClass:0)
at android.view.View.performClick(View.java:7659)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1218)
at android.view.View.performClickInternal(View.java:7636)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:30156)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
How to Reproduce
1.Open the DuckDuckGo app
2.Navigate to:Setting → Developer Settings → Tabs
3.In the input field, enter a string containing letters (e.g., 12w)
4.Click the "Add Tabs" button
5.Observe the app crash
test.webm
Expected behavior
The app should gracefully reject or sanitize invalid inputs (e.g., with toIntOrNull() and a fallback), or prompt the user with an error message instead of crashing.
Environment
- DDG App Version:5.227.0
- Device:Pixel 4
- OS:Android 14