chiark / gitweb /
do not crash if no versionCode is found while parsing
authorHans-Christoph Steiner <hans@eds.org>
Mon, 27 Feb 2017 12:38:59 +0000 (13:38 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Tue, 28 Feb 2017 11:08:04 +0000 (12:08 +0100)
if vercode is None and max_vercode is None, then it gave None as an arg to
the regexp pattern in ignoresearch().

closes #261

fdroidserver/common.py

index 5321b7b63da2a0a0662e7a6dbde0e52d60654264..c13e2f9486bac2979af177af1f6a97283c7d8a41 100644 (file)
@@ -1160,12 +1160,11 @@ def parse_androidmanifests(paths, app):
             continue
 
         logging.debug("Parsing manifest at {0}".format(path))
-        gradle = has_extension(path, 'gradle')
         version = None
         vercode = None
         package = None
 
-        if gradle:
+        if has_extension(path, 'gradle'):
             with open(path, 'r') as f:
                 for line in f:
                     if gradle_comment.match(line):
@@ -1218,7 +1217,8 @@ def parse_androidmanifests(paths, app):
         if max_version is None and version is not None:
             max_version = version
 
-        if max_vercode is None or (vercode is not None and vercode > max_vercode):
+        if vercode is not None \
+           and (max_vercode is None or vercode > max_vercode):
             if not ignoresearch or not ignoresearch(version):
                 if version is not None:
                     max_version = version