Skip to content

Commit a0bbdee

Browse files
authored
fix: add None checks to run_java_checker (#1630)
1 parent af159c8 commit a0bbdee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cve_bin_tool/version_scanner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,13 @@ def run_java_checker(self, filename: str) -> Iterator[ScanInfo]:
234234
if parent is None:
235235
product = root.find(schema + "artifactId").text
236236
version = root.find(schema + "version").text
237-
if version is None:
237+
if version is None and parent is not None:
238238
version = parent.find(schema + "version").text
239239
# Check valid version identifier (i.e. starts with a digit)
240240
if not version[0].isdigit():
241241
self.logger.debug(f"Invalid {version} detected in {filename}")
242242
version = None
243-
if product is None:
243+
if product is None and parent is not None:
244244
product = parent.find(schema + "artifactId").text
245245
if product is not None and version is not None:
246246
product_info, file_path = self.find_java_vendor(product, version)

0 commit comments

Comments
 (0)