fix: artwork directory null crash on orientation change

This commit is contained in:
edde746
2026-04-15 06:11:07 +02:00
parent 8380980abd
commit 4663c435c9
+4 -5
View File
@@ -52,6 +52,7 @@ class DownloadStorageService {
_customPathType = _settingsService!.getCustomDownloadPathType();
_baseDownloadsDir = null;
_artworkDirectoryPath = null;
await getArtworkDirectory();
}
}
@@ -154,12 +155,10 @@ class DownloadStorageService {
}
/// Get artwork file path from Plex thumb path (synchronous, requires initialization)
/// Returns path to cached artwork file using hash of the thumb URL
/// Returns path to cached artwork file using hash of the thumb URL, or null if not initialized
/// Example: artwork/a1b2c3d4e5f6.jpg
String getArtworkPathSync(String serverId, String thumbPath) {
if (_artworkDirectoryPath == null) {
throw StateError('Artwork directory not initialized. Call getArtworkDirectory() first.');
}
String? getArtworkPathSync(String serverId, String thumbPath) {
if (_artworkDirectoryPath == null) return null;
// Create hash from serverId:thumbPath for deduplication
final hash = _hashArtworkPath(serverId, thumbPath);
return path.join(_artworkDirectoryPath!, '$hash.jpg');