fix: app crashes after installation

This commit is contained in:
Vinicius Moreira
2019-07-13 12:53:08 -03:00
parent 6723e6be65
commit 332d3cb787
2 changed files with 6 additions and 6 deletions

View File

@@ -13,8 +13,7 @@ class Cache:
return self.expiration_time < 0 or self.expiration_time > 0
def add(self, key: str, val: object):
if self.is_enabled():
if key and self.is_enabled():
self.lock.acquire()
self._add(key, val)
self.lock.release()
@@ -24,7 +23,7 @@ class Cache:
def add_non_existing(self, key: str, val: object):
if self. is_enabled():
if key and self. is_enabled():
self.lock.acquire()
cur_val = self.get(key)
@@ -34,7 +33,7 @@ class Cache:
self.lock.release()
def get(self, key: str):
if self.is_enabled():
if key and self.is_enabled():
val = self._cache.get(key)
if val:
@@ -49,7 +48,7 @@ class Cache:
return val['val']
def delete(self, key):
if self.is_enabled():
if key and self.is_enabled():
if key in self._cache:
self.lock.acquire()
del self._cache[key]

View File

@@ -221,8 +221,9 @@ class InstallApp(QThread):
self.app.model.installed = True
if self.app.model.supports_disk_cache():
icon_data = self.icon_cache.get(self.app.model.base_data.icon_url)
self.manager.cache_to_disk(app=self.app.model,
icon_bytes=self.icon_cache.get(self.app.model.base_data.icon_url)['bytes'],
icon_bytes=icon_data.get('bytes') if icon_data else None,
only_icon=False)
self.app = None