[Sugar-devel] [PATCH sugar] Avoid popping an empty list in the software updater.

Sascha Silbe sascha-pgp at silbe.org
Fri Jan 21 10:23:53 EST 2011


From: Michael Stone <michael at laptop.org>

When you run Sugar with no activities installed, UpdateModel._bundles_to_check
is empty. Attempting to unconditionally pop this list results in an IndexError.
Instead, the updater should stop trying to update bundles when it determines
that it has no more bundles to check.

Signed-off-by: Michael Stone <michael at laptop.org>
[style fix]
Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>
Reviewed-by: Sascha Silbe <sascha-pgp at silbe.org>
---
 extensions/cpsection/updater/model.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py
index 77cc873..896c17f 100755
--- a/extensions/cpsection/updater/model.py
+++ b/extensions/cpsection/updater/model.py
@@ -73,6 +73,9 @@ class UpdateModel(gobject.GObject):
         total = len(bundleregistry.get_registry())
         current = total - len(self._bundles_to_check)
 
+        if not self._bundles_to_check:
+            return False
+
         bundle = self._bundles_to_check.pop()
         self.emit('progress', UpdateModel.ACTION_CHECKING, bundle.get_name(),
                   current, total)
-- 
1.7.2.3



More information about the Sugar-devel mailing list