-
Notifications
You must be signed in to change notification settings - Fork 820
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 in robotic arm activity #2652
fix: crash in robotic arm activity #2652
Conversation
Reviewer's Guide by SourceryThis pull request fixes a crash in the Robotic Arm activity that occurred when the app tried to parse an empty string to an integer. To fix this, the code was modified to validate the input from the EditText fields. If the input is empty, the code now restores the previous valid value. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rahul31124 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider refactoring the duplicated code into a separate method to improve readability and maintainability.
- The logic for restoring the previous degree when the input is empty could be simplified.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/14229326177/artifacts/2870705654 |
2c464c1
to
445cf8c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully tested with Android 13 device.
Crash Fix
The Robotic Arm screen was crashing due to a java.lang.NumberFormatException when the EditText view was empty and the "Done" button was pressed
Exception
java.lang.NumberFormatException: For input string: ""
at java.lang.Integer.parseInt(Integer.java:807)
at java.lang.Integer.valueOf(Integer.java:1128)
at io.pslab.activity.RoboticArmActivity$15.onEditorAction(RoboticArmActivity.java:436)
at android.widget.TextView.onEditorAction(TextView.java:7967)
Changes
Added validation to check if the EditText is empty before parsing the value.
If the input is empty, the previous valid value is restored.
Screenshots / Recordings
Before
Robotic_Arm_Before.webm
After
Robotic_Arm_After.webm
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard coding any value.strings.xml
,dimens.xml
orcolors.xml
.Summary by Sourcery
Bug Fixes: