-
-
Notifications
You must be signed in to change notification settings - Fork 45
Fixed map crash on data error #3517
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
Conversation
📝 WalkthroughWalkthroughThe change modifies three helper methods in Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 🧪 Unit Test Generation v2 is now available!We have significantly improved our unit test generation capabilities. To enable: Add this to your reviews:
finishing_touches:
unit_tests:
enabled: trueTry it out by using the Have feedback? Share your thoughts on our Discord thread! Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/src/org/commcare/gis/EntityMapActivity.java (1)
270-299: Skip empty boundaries to avoid bounds build crash.If
getBoundary()returns a non-null but empty list (possible with invalid data), no coordinates are included, yet the method returnstrue. That makesaddedtrue and can still triggerbuilder.build()with no points, which will throw. Guard against empty boundaries and returnfalsein that case.Proposed fix
- if (displayInfo.getBoundary() != null) { + if (displayInfo.getBoundary() != null && !displayInfo.getBoundary().isEmpty()) { int color = displayInfo.getBoundaryColorHex() != null ? displayInfo.getBoundaryColorHex() : Color.WHITE; @@ numPolygons++; return true; } return false;
shubham1g5
left a comment
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.
I am finding it hard to identify where the code was crashing due to invalid co-ordinates based on the solution here, can we please add the stacktrace for the crash.
|
@shubham1g5 No problem, added the stack trace. Specifically the problem was calling |
https://dimagi.atlassian.net/browse/QA-8360
Product Description
Fixes a bug where the map would crash if errors in the map data (such as incorrectly formatted GPS points) caused there to be no valid coordinates. Now, the map appears with the error message indicating something went wrong.
Technical Summary
Checking to make sure at least one coordinate was added to the map before attempting to build bounds.
Later, the map is only zoomed after loading if bounds were calculated.
Stack trace of prior crash:
Feature Flag
None
Safety Assurance
Safety story
I was able to reproduce the crash before applying the fix.
After applying the fix, the crash no longer occurs and instead the map loads with an error message.
Automated test coverage
None
QA Plan
See the linked ticket for details on a QA test user that was crashing before.
Test loading the map with that user and verify there's no crash.