Skip to content

Commit

Permalink
Update playonlinux.py
Browse files Browse the repository at this point in the history
Avoid strings in version1 and version2 variables with isnumeric() function, and handling error with try-except block.
  • Loading branch information
5m0k3r committed Feb 4, 2022
1 parent 749917b commit c59d03b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions python/lib/playonlinux.py
Expand Up @@ -278,11 +278,17 @@ def VersionLower(version1, version2):
else:
return False

version1 = [ int(digit) for digit in version1[0].split(".")[:3] ]
try:
version1 = [ int(digit) for digit in version1[0].split(".") ]
except ValueError:
version1 = [ int(digit) for digit in version1[0].split(".") if digit.isnumeric() ]
while len(version1) < 3:
version1.append(0)

version2 = [ int(digit) for digit in version2[0].split(".")[:3] ]
try:
version2 = [ int(digit) for digit in version2[0].split(".") ]
except ValueError:
version2 = [ int(digit) for digit in version2[0].split(".") if digit.isnumeric() ]
while len(version2) < 3:
version2.append(0)

Expand Down

0 comments on commit c59d03b

Please sign in to comment.