Skip to content

Commit ce65dd6

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

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/notifications/display.dart

Lines changed: 5 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,12 @@ class NotificationDisplayManager {
281282
try {
282283
// TODO timeout to prevent waiting indefinitely
283284
final resp = await http.get(url);
284-
return resp.bodyBytes;
285+
if (resp.statusCode == HttpStatus.ok) {
286+
return resp.bodyBytes;
287+
}
285288
} catch (e) {
286289
// TODO(log)
287-
return null;
288290
}
291+
return null;
289292
}
290293
}

0 commit comments

Comments
 (0)