Safe guard against invalid assets

This commit is contained in:
Vishnu Mohandas 2021-05-26 00:42:26 +05:30
parent 30299098dc
commit 0c10209624

View file

@ -49,15 +49,17 @@ void preloadThumbnail(File file) {
return;
}
file.getAsset().then((asset) {
asset
.thumbDataWithSize(
THUMBNAIL_SMALL_SIZE,
THUMBNAIL_SMALL_SIZE,
quality: THUMBNAIL_QUALITY,
)
.then((data) {
ThumbnailLruCache.put(file, data, THUMBNAIL_SMALL_SIZE);
});
if (asset != null) {
asset
.thumbDataWithSize(
THUMBNAIL_SMALL_SIZE,
THUMBNAIL_SMALL_SIZE,
quality: THUMBNAIL_QUALITY,
)
.then((data) {
ThumbnailLruCache.put(file, data, THUMBNAIL_SMALL_SIZE);
});
}
});
}
}