From ce10fcb7591c49aa747404294f2b71fe7243098e Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Sun, 29 Nov 2020 10:02:30 +0100 Subject: [PATCH] Check if build_tools path exists before listdir --- fdroidserver/common.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 9e4f82bf..2b82526c 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -498,9 +498,10 @@ def find_sdk_tools_cmd(cmd): if config is not None and 'sdk_path' in config and os.path.exists(config['sdk_path']): # try to find a working path to this command, in all the recent possible paths build_tools = os.path.join(config['sdk_path'], 'build-tools') - for f in sorted(os.listdir(build_tools), reverse=True): - if os.path.isdir(os.path.join(build_tools, f)): - tooldirs.append(os.path.join(build_tools, f)) + if os.path.isdir(build_tools): + for f in sorted(os.listdir(build_tools), reverse=True): + if os.path.isdir(os.path.join(build_tools, f)): + tooldirs.append(os.path.join(build_tools, f)) sdk_tools = os.path.join(config['sdk_path'], 'tools') if os.path.exists(sdk_tools): tooldirs.append(sdk_tools)