fix: add error handling for launchUrl in Map screen#3401
Merged
marcnause merged 1 commit intoJul 6, 2026
Conversation
Contributor
There was a problem hiding this comment.
Sorry @prajakta128, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Contributor
Build StatusBuild successful. APKs to test: https://github.com/fossasia/pslab-app/actions/runs/28768630489/artifacts/8100154005. Screenshots |
The OpenStreetMap attribution link in map_screen.dart called launchUrl() directly with no canLaunchUrl check and no error handling. If the URL fails to launch for any reason, the app throws an unhandled exception and crashes. Added canLaunchUrl check and logger.e() for the failure case, consistent with how the same issue is already handled in about_us_screen.dart, faq_screen.dart and connect_device_screen.dart. Fixes fossasia#3400
331416e to
b21959d
Compare
marcnause
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.







-1_instruments_screen.png?raw=true)
-2_nav_drawer.png?raw=true)
-3_accelerometer.png?raw=true)
-4_power_source.png?raw=true)
-5_multimeter.png?raw=true)
-6_wave_generator.png?raw=true)
-7_oscilloscope.png?raw=true)
Fixes #3400
Problem
The OpenStreetMap attribution link in
lib/view/map_screen.dartcalledlaunchUrl()directly with nocanLaunchUrlcheck and no error handling. If the URL fails to launch for any reason (no browser, network issue), the app throws an unhandled exception and crashes.Root Cause
The
onTaphandler used a fire-and-forgetlaunchUrlcall with no guard, unlike other links in the app which already usecanLaunchUrlcorrectly.Fix
Added
canLaunchUrlcheck andlogger.e()for the failure case, consistent with the existing pattern already used inabout_us_screen.dart,faq_screen.dartandconnect_device_screen.dart.Impact
Screenshots / Recordings
N/A — crash fix, no UI changes
Checklist
constants.dartor localization files instead of hard-coded values.dart formator the IDE formatter.flutter analyzeand tests run influtter test.