Skip to content

Commit 7ffc222

Browse files
committed
fix: add error handling for launchUrl in About Us feedback link
The feedback/bug-report link in about_us_screen.dart called launchUrl() directly with no canLaunchUrl check and no try/catch. If the URL fails to launch for any reason, the app throws an unhandled exception and crashes. Added canLaunchUrl check before calling launchUrl, consistent with the existing pattern used by other links in the same file. Fixes #3374
1 parent 7d07ca4 commit 7ffc222

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

lib/view/about_us_screen.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,14 @@ 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(
143+
'Could not launch ${appLocalizations.feedbackForm}',
144+
);
145+
}
139146
},
140147
),
141148
const Divider(thickness: 0.5),
@@ -162,7 +169,8 @@ class _AboutUsScreenState extends State<AboutUsScreen> {
162169
);
163170
} else if (snapshot.hasError) {
164171
logger.e(
165-
"Error getting version information: ${snapshot.error.toString()}");
172+
"Error getting version information: ${snapshot.error.toString()}",
173+
);
166174
return Text(
167175
appLocalizations.error,
168176
style: const TextStyle(fontSize: 15),

0 commit comments

Comments
 (0)