Skip to content

Commit

Permalink
catch possible error in version comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
akshualy committed Jun 14, 2024
1 parent 81de157 commit 3cd3c3c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions alune/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ def is_version_string_newer(version_one: str, version_two: str):
version_two_parts = version_two.split(".")

for i in range(min(len(version_one_parts), len(version_two_parts))):
if int(version_one_parts[i]) > int(version_two_parts[i]):
return True
try:
if int(version_one_parts[i]) > int(version_two_parts[i]):
return True
except ValueError:
logger.warning(
f"We could not check version {version_one} against {version_two}. "
f"Assuming the installed version ({version_two}) is newer."
)
return False
return False


Expand Down

0 comments on commit 3cd3c3c

Please sign in to comment.