scanner: safely check options, for things using this API

https://gitlab.com/fdroid/fdroidserver/-/issues/771#note_353495799
This commit is contained in:
Hans-Christoph Steiner 2020-06-03 18:34:26 +02:00
parent 75acf63efa
commit ee54dbce87
3 changed files with 3 additions and 4 deletions

View file

@ -172,9 +172,9 @@ def scan_source(build_dir, build=metadata.Build()):
return ignoreproblem(what, path_in_build_dir)
if todelete(path_in_build_dir):
return removeproblem(what, path_in_build_dir, filepath)
if options.json:
if options and options.json:
json_per_build['errors'].append([what, path_in_build_dir])
if not options.json or options.verbose:
if options and (options.verbose or not options.json):
logging.error('Found %s at %s' % (what, path_in_build_dir))
return 1