Skip to content

Commit

Permalink
fix: check empty bytes before decoding (#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmo314 authored Jan 9, 2023
1 parent 13d9f61 commit a00d250
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/components/image/resilient_network_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,11 @@ class ResilientNetworkImage extends ImageProvider<ResilientNetworkImage> {
if (await cacheFile.exists() && await etagFile.exists()) {
try {
final bytes = await cacheFile.readAsBytes();
decodedCache = await decode(await ImmutableBuffer.fromUint8List(bytes));
etagValue = await etagFile.readAsString();
if (bytes.isNotEmpty) {
decodedCache =
await decode(await ImmutableBuffer.fromUint8List(bytes));
etagValue = await etagFile.readAsString();
}
} catch (e) {
FirebaseCrashlytics.instance.recordError(e, StackTrace.current);
}
Expand Down

0 comments on commit a00d250

Please sign in to comment.