Skip to content

Commit 8844d48

Browse files
committed
fix: handle exceptions in getLocalAssetFullPath
1 parent c949fd1 commit 8844d48

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

modules/ensemble/lib/util/utils.dart

+10-6
Original file line numberDiff line numberDiff line change
@@ -1003,12 +1003,16 @@ class Utils {
10031003
/// prefix the asset with the app root directory (i.e. ensemble/apps/<app-name>/assets/), plus
10041004
/// stripping any unnecessary query params (e.g. anything after the first ?)
10051005
static String getLocalAssetFullPath(String asset) {
1006-
String provider = EnsembleConfigService.config["definitions"]?['from'];
1007-
if(provider == 'local') {
1008-
String path = EnsembleConfigService.config["definitions"]?['local']?["path"];
1009-
return '${path}/assets/${stripQueryParamsFromAsset(asset)}';
1010-
}
1011-
else{
1006+
try {
1007+
String provider = EnsembleConfigService.config["definitions"]?['from'];
1008+
if (provider == 'local') {
1009+
String path =
1010+
EnsembleConfigService.config["definitions"]?['local']?["path"];
1011+
return '${path}/assets/${stripQueryParamsFromAsset(asset)}';
1012+
} else {
1013+
return 'ensemble/assets/${stripQueryParamsFromAsset(asset)}';
1014+
}
1015+
} catch (e) {
10121016
return 'ensemble/assets/${stripQueryParamsFromAsset(asset)}';
10131017
}
10141018
}

0 commit comments

Comments
 (0)