[flatpak] fix: crashing when trying to retrieve size of runtimes subcomponents

This commit is contained in:
Vinicius Moreira
2021-01-13 10:33:55 -03:00
parent 5b40911321
commit b451d00aaf
2 changed files with 12 additions and 7 deletions

View File

@@ -411,12 +411,15 @@ def map_update_download_size(app_ids: Iterable[str], installation: str, version:
related_id = [appid for appid in app_ids if appid == line_id]
if related_id:
size = p2.findall(line_split[6])[0].split('?')
if related_id and len(line_split) >= 7:
size_tuple = p2.findall(line_split[6])
if size and len(size) > 1:
try:
res[related_id[0].strip()] = size_to_byte(float(size[0]), size[1])
except:
traceback.print_exc()
if size_tuple:
size = size_tuple[0].split('?')
if size and len(size) > 1:
try:
res[related_id[0].strip()] = size_to_byte(float(size[0]), size[1])
except:
traceback.print_exc()
return res