Skip to content

Commit 2e37e33

Browse files
ltOgtmartijn00
authored andcommitted
add only if has listener
1 parent 942bc8d commit 2e37e33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

flutter_cache_manager/lib/src/cache_manager.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ class CacheManager implements BaseCacheManager {
156156
}
157157

158158
if (cacheFile != null && e is HttpExceptionWithStatus && e.statusCode == 404) {
159-
streamController.addError(e);
159+
if (streamController.hasListener) {
160+
streamController.addError(e);
161+
}
160162
await removeFile(key);
161163
}
162164
}

0 commit comments

Comments
 (0)