Skip to content

Commit c7331b7

Browse files
committed
fix: add error handling for launchUrl in About Us screen
The feedback link in about_us_screen.dart called launchUrl() with no canLaunchUrl check or try/catch block. If the URL fails to launch, this throws an unhandled exception and crashes the app. Added canLaunchUrl check consistent with how other links in the same file are already handled. Fixes #XXXX
1 parent 5936ac6 commit c7331b7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/view/about_us_screen.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ class _AboutUsScreenState extends State<AboutUsScreen> {
135135
style: const TextStyle(fontSize: 15),
136136
),
137137
onTap: () async {
138-
await launchUrl(Uri.parse(appLocalizations.feedbackForm));
138+
final uri = Uri.parse(appLocalizations.feedbackForm);
139+
if (await canLaunchUrl(uri)) {
140+
await launchUrl(uri);
141+
} else {
142+
debugPrint('Could not launch ${appLocalizations.feedbackForm}');
143+
}
139144
},
140145
),
141146
const Divider(thickness: 0.5),

0 commit comments

Comments
 (0)