[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

@@ -57,6 +57,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- some updates or download sizes not being displayed when there are new required runtimes for installed Flatpaks
- not displaying new required runtimes as updates (requires Flatpak >= 1.12)
- upgrade: informing the download size as the additional installation size
- random index out of bounds exception when reading updates
- UI
- not displaying the right unit symbol for byte based sizes (kB, MB, TB, ...) [#250](https://github.com/vinifmor/bauh/issues/250)

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}'