Skip to content

Commit c47be3d

Browse files
SAY-5mtwebster
authored andcommitted
checkAPT: handle packages without a candidate version
Skip installed packages whose apt cache candidate is None instead of crashing with 'NoneType has no attribute version'. This can happen when a package is orphaned or removed from the configured repositories, and previously caused the entire update list refresh to fail. Closes #1059 Signed-off-by: SAY-5 <say.apm35@gmail.com>
1 parent 648a624 commit c47be3d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

usr/lib/linuxmint/mintUpdate/aptUpdater.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ def find_changes(self):
240240

241241
# Package updates
242242
for pkg in changes:
243+
if pkg.candidate is None:
244+
# Installed package has no candidate version (e.g. orphaned
245+
# or removed from the repositories). Skip it so the rest of
246+
# the update list can still be refreshed.
247+
print("Skipping package without candidate version: %s" % pkg.name)
248+
continue
243249
if (pkg.is_installed and pkg.candidate.version != pkg.installed.version):
244250
if (pkg.marked_upgrade or pkg.marked_downgrade):
245251
self.add_update(pkg)

0 commit comments

Comments
 (0)