1
0
Fork 0
mirror of synced 2024-06-23 08:40:45 +12:00

Merge pull request #216 from loathingKernel/library_logic

ImageManager: Handle broken image.cache
This commit is contained in:
Dummerle 2022-06-21 09:53:06 +02:00 committed by GitHub
commit da872bf424
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -285,9 +285,13 @@ class ImageManager(QObject):
def __decompress(self, game: Game) -> Dict:
archive = open(self.__img_cache(game.app_name), "rb")
data = zlib.decompress(archive.read())
archive.close()
data = pickle.loads(data)
try:
data = zlib.decompress(archive.read())
data = pickle.loads(data)
except zlib.error:
data = dict(zip(self.__img_types, [None] * len(self.__img_types)))
finally:
archive.close()
return data
def download_image(