[flatpak] fix: random index out of bounds exception when reading updates

This commit is contained in:
Vinicius Moreira
2022-04-13 14:34:52 -03:00
parent dd3baf8d0a
commit 4c9ca22b43
2 changed files with 11 additions and 3 deletions

View File

@@ -247,11 +247,18 @@ def fill_updates(version: Version, installation: str, res: Dict[str, Set[str]]):
if o:
line_split = o.decode().strip().split('\t')
if len(line_split) > 2:
if len(line_split) >= 5:
if version >= VERSION_1_5:
update_id = f'{line_split[2]}/{line_split[3]}/{installation}/{line_split[5]}'
update_id = f'{line_split[2]}/{line_split[3]}/{installation}'
if len(line_split) >= 6:
update_id = f'{update_id}/{line_split[5]}'
elif version >= VERSION_1_2:
update_id = f'{line_split[2]}/{line_split[4]}/{installation}/{line_split[5]}'
update_id = f'{line_split[2]}/{line_split[4]}/{installation}'
if len(line_split) >= 6:
update_id = f'{update_id}/{line_split[5]}'
else:
update_id = f'{line_split[2]}/{line_split[4]}/{installation}'