fix: error from pre-caching beyond total assets

This commit is contained in:
shenlong-tanwen 2025-07-08 17:39:32 +05:30
parent 74b2dafa58
commit cdc2927d47

View File

@ -184,7 +184,7 @@ class TimelineService {
// Pre-cache assets around the given index for asset viewer // Pre-cache assets around the given index for asset viewer
Future<void> preCacheAssets(int index) => Future<void> preCacheAssets(int index) =>
_mutex.run(() => _loadAssets(index, 5)); _mutex.run(() => _loadAssets(index, math.min(5, totalAssets - index)));
BaseAsset getAsset(int index) { BaseAsset getAsset(int index) {
if (!hasRange(index, 1)) { if (!hasRange(index, 1)) {