[Piuparts-commits] [piuparts] 09/11: lib/db: check package existence in rrdep accessors

Holger Levsen holger at moszumanska.debian.org
Sun Dec 8 12:16:41 UTC 2013


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit 88f6ce6b5a6c4a1c4d2db6a84f546bbe59dbaab6
Author: Andreas Beckmann <anbe at debian.org>
Date:   Thu May 30 11:05:04 2013 +0200

    lib/db: check package existence in rrdep accessors
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 piupartslib/packagesdb.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 93b8eff..7f38fd8 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -807,24 +807,32 @@ class PackagesDB:
         pkg.rdep_chain_len = chain_len
 
     def block_count(self, pkg):
+        if pkg is None:
+            return -1
         if pkg.block_cnt is None:
             self._calc_rrdep_pkg_counts(pkg)
 
         return pkg.block_cnt
 
     def rrdep_count(self, pkg):
+        if pkg is None:
+            return -1
         if pkg.rrdep_cnt is None:
             self._calc_rrdep_pkg_counts(pkg)
 
         return pkg.rrdep_cnt
 
     def waiting_count(self, pkg):
+        if pkg is None:
+            return -1
         if pkg.waiting_cnt is None:
             self._calc_rrdep_pkg_counts(pkg)
 
         return pkg.waiting_cnt
 
     def rdep_chain_len(self, pkg):
+        if pkg is None:
+            return -1
         if pkg.rdep_chain_len is None:
             self._calc_rrdep_pkg_counts(pkg)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list