Skip to content

Commit 8556775

Browse files
notif: Ensure fetchBitmap succeeds only on HTTP 200 status
1 parent 2393a19 commit 8556775

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/notifications/display.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:convert';
2+
import 'dart:io';
23

34
import 'package:http/http.dart' as http;
45
import 'package:collection/collection.dart';
@@ -281,10 +282,13 @@ class NotificationDisplayManager {
281282
try {
282283
// TODO timeout to prevent waiting indefinitely
283284
final resp = await http.get(url);
284-
return resp.bodyBytes;
285+
final bodyBytes = resp.bodyBytes;
286+
if (resp.statusCode == HttpStatus.ok) {
287+
return bodyBytes;
288+
}
285289
} catch (e) {
286290
// TODO(log)
287-
return null;
288291
}
292+
return null;
289293
}
290294
}

0 commit comments

Comments
 (0)