[view] fix: crashing when sorting packages

This commit is contained in:
Vinicius Moreira
2022-03-14 12:38:31 -03:00
parent acc7b173f0
commit 8392dc753c

View File

@@ -99,7 +99,7 @@ def sort_packages(pkgs: Iterable[SoftwarePackage], word: str, limit: int = 0) ->
res = [] res = []
for app_list in (exact, starts_with, contains, others): for app_list in (exact, starts_with, contains, others):
if app_list: if app_list:
last = limit - len(res) if limit > 0 else None last = limit - len(res) if limit is not None and limit > 0 else None
if last is not None and last <= 0: if last is not None and last <= 0:
break break