[gnome-ostree] jsondb: Don't return nonexistent file for previous



commit 9d139780f2100a28a49e77362c4ddca55b608ae7
Author: Colin Walters <walters verbum org>
Date:   Tue Nov 20 15:21:47 2012 -0500

    jsondb: Don't return nonexistent file for previous

 src/ostbuild/pyostbuild/jsondb.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/jsondb.py b/src/ostbuild/pyostbuild/jsondb.py
index e6ca233..a34b594 100644
--- a/src/ostbuild/pyostbuild/jsondb.py
+++ b/src/ostbuild/pyostbuild/jsondb.py
@@ -81,11 +81,15 @@ class JsonDB(object):
         (target_major, target_minor) = (int(match.group(1)), int(match.group(2)))
         files = self._get_all()
         prev = None
+        found = False
         for (major, minor, csum, fname) in reversed(files):
             if target_major == major and target_minor == minor:
+                found = True
                 break
             prev = fname
-        return prev
+        if found:
+            return prev
+        return None
 
     def parse_version(self, name):
         match = self._version_csum_re.search(name)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]