Skip to content

Commit e10ba69

Browse files
Eduard Čubaj-mracek
authored andcommitted
[swdb]: skip package comparison if package isn't found
1 parent 7ddadf4 commit e10ba69

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

dnf/cli/output.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,19 +1643,18 @@ def _simple_pkg(pkg, prefix_len, was_installed=False, highlight=False,
16431643
else:
16441644
# get latest installed package from software database
16451645
inst_pkg = self.history.package(ipkgs[0])
1646-
1647-
# result is:
1648-
# 0 if inst_pkg == pkg
1649-
# > 0 when inst_pkg > pkg
1650-
# < 0 when inst_pkg < pkg
1651-
res = pkg.compare(inst_pkg)
1652-
1653-
if res == 0:
1654-
pass # installed
1655-
elif res > 0:
1656-
state = _pkg_states['o'] # updated
1657-
else:
1658-
state = _pkg_states['n'] # downgraded
1646+
if inst_pkg:
1647+
res = pkg.compare(inst_pkg)
1648+
# res is:
1649+
# 0 if inst_pkg == pkg
1650+
# > 0 when inst_pkg > pkg
1651+
# < 0 when inst_pkg < pkg
1652+
if res == 0:
1653+
pass # installed
1654+
elif res > 0:
1655+
state = _pkg_states['o'] # updated
1656+
else:
1657+
state = _pkg_states['n'] # downgraded
16591658

16601659
if highlight:
16611660
(hibeg, hiend) = self._highlight('bold')

0 commit comments

Comments
 (0)