@@ -129,42 +129,46 @@ class LinuxAppFinder {
129
129
if (! isAppEntry (contents)) {
130
130
return ;
131
131
}
132
- List <String > lines = contents.split ('\n ' );
133
- String name =
134
- lines.where ((line) => line.startsWith ('Name=' )).first.substring (5 );
135
- String icon =
136
- lines.where ((line) => line.startsWith ('Icon=' )).first.substring (5 );
137
- String exe =
138
- lines.where ((line) => line.startsWith ('Exec=' )).first.substring (5 );
139
- // completing icon path if incomplete
140
- bool found = icon.contains ('/' );
141
- bool foundInPixmaps = false ;
142
- if (! found) {
143
- Directory pixmapsDir = Directory ('/usr/share/pixmaps' );
144
- var icons = pixmapsDir.listSync ();
145
- for (var entity in icons) {
146
- if (entity.path.contains ("/$icon ." )) {
147
- icon = entity.path;
148
- foundInPixmaps = true ;
149
- break ;
132
+ try {
133
+ List <String > lines = contents.split ('\n ' ).toList ();
134
+ String name =
135
+ lines.firstWhere ((line) => line.startsWith ('Name=' )).substring (5 );
136
+ String icon =
137
+ lines.firstWhere ((line) => line.startsWith ('Icon=' )).substring (5 );
138
+ String exe =
139
+ lines.firstWhere ((line) => line.startsWith ('Exec=' )).substring (5 );
140
+ // completing icon path if incomplete
141
+ bool found = icon.contains ('/' );
142
+ bool foundInPixmaps = false ;
143
+ if (! found) {
144
+ Directory pixmapsDir = Directory ('/usr/share/pixmaps' );
145
+ var icons = pixmapsDir.listSync ();
146
+ for (var entity in icons) {
147
+ if (entity.path.contains ("/$icon ." )) {
148
+ icon = entity.path;
149
+ foundInPixmaps = true ;
150
+ break ;
151
+ }
150
152
}
151
153
}
152
- }
153
- if ( ! foundInPixmaps) {
154
- String ? inferredIcon = _searchIconsFromIconThemes (icon);
155
- if (inferredIcon != null ) {
156
- icon = inferredIcon;
154
+ if ( ! foundInPixmaps) {
155
+ String ? inferredIcon = _searchIconsFromIconThemes (icon);
156
+ if ( inferredIcon != null ) {
157
+ icon = inferredIcon;
158
+ }
157
159
}
158
- }
159
- if (File (icon). existsSync ( )) {
160
- if ( checkImageValidity (icon)) {
161
- apps. add ( App (
162
- name : name ,
163
- iconPath : icon ,
164
- exe : exe ,
165
- internallyGenerated : true ,
166
- ));
160
+ if ( File (icon). existsSync ()) {
161
+ if (checkImageValidity (icon)) {
162
+ apps. add ( App (
163
+ name : name,
164
+ iconPath : icon ,
165
+ exe : exe ,
166
+ internallyGenerated : true ,
167
+ ));
168
+ }
167
169
}
170
+ } catch (e) {
171
+ // ignore
168
172
}
169
173
}
170
174
0 commit comments