Skip to content

Commit b1f3e91

Browse files
committed
Debugging modules without the 'installed' key
Signed-off-by: Ethan Lee <[email protected]>
1 parent 962dea9 commit b1f3e91

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/fosslight_android/android_binary_analysis.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,22 @@ def get_module_json_obj_by_installed_path(module_name, binary_name_with_path, bi
155155
return js_value
156156
else: # Find binary by installed path
157157
for key in module_info_json_obj:
158-
js_value = module_info_json_obj[key]
159-
output_files = js_value["installed"]
160-
if output_files is not None:
161-
for output_file in output_files:
162-
if output_file == binary_name_with_path:
163-
js_value[MODULE_TYPE_NAME] = key
164-
return js_value
165-
else:
166-
path_with_out_dir = os.path.join(build_out_path, binary_name_with_path)
167-
if path_with_out_dir == output_file:
158+
try:
159+
js_value = module_info_json_obj[key]
160+
output_files = js_value["installed"]
161+
if output_files is not None:
162+
for output_file in output_files:
163+
if output_file == binary_name_with_path:
168164
js_value[MODULE_TYPE_NAME] = key
169165
return js_value
166+
else:
167+
path_with_out_dir = os.path.join(build_out_path, binary_name_with_path)
168+
if path_with_out_dir == output_file:
169+
js_value[MODULE_TYPE_NAME] = key
170+
return js_value
171+
except KeyError as e:
172+
print(f"The 'installed' key does not exist. key: {key}")
173+
return ""
170174
return ""
171175

172176

0 commit comments

Comments
 (0)