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
This commit is contained in:
Hans-Christoph Steiner 2017-02-27 13:38:59 +01:00
parent d92ac1e8f6
commit 507ed4a170

View 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