From: Hans-Christoph Steiner Date: Mon, 27 Feb 2017 12:38:59 +0000 (+0100) Subject: do not crash if no versionCode is found while parsing X-Git-Tag: 0.8~116^2~4 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=507ed4a1704b0cb1fd6110d4c961770e843a6065;p=fdroidserver.git do not crash if no versionCode is found while parsing if vercode is None and max_vercode is None, then it gave None as an arg to the regexp pattern in ignoresearch(). closes #261 --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 5321b7b6..c13e2f94 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -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