From fc6fa71747a3466e29b743191c6587691e1f0f7f Mon Sep 17 00:00:00 2001 From: anthonyharrison Date: Mon, 9 Dec 2024 19:39:10 +0000 Subject: [PATCH] fix: handling non-semantic versions --- lib4sbom/generator.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib4sbom/generator.py b/lib4sbom/generator.py index 0979d06..652739e 100644 --- a/lib4sbom/generator.py +++ b/lib4sbom/generator.py @@ -263,9 +263,14 @@ def _get_element(self, name, id=None): current_version = self._semantic_version( c[1].split("_")[-1] ) - if current_version > latest_version: - latest_version = current_version - index = i + try: + if current_version > latest_version: + latest_version = current_version + index = i + except TypeError: + if self.debug: + print (f"Current {current_version} {type(current_version)} {name}") + print (f"Latest {latest_version} {type(latest_version)}") elif c[1] == id: return c[0] i += 1