Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/splitguides/livesplit_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def parse_time(time_str: str) -> timedelta:
:param time_str:
:return:
"""
if time_str == "":
# If there is no str, return a timedelta of 0
return timedelta()

match = pattern.match(time_str)
if match is None:
raise RuntimeError("String time from livesplit did not match expected pattern")
Expand Down Expand Up @@ -145,7 +149,10 @@ def receive(self, datatype="text"):
if datatype == "time":
result = parse_time(result)
elif datatype == "int":
return int(result)
try:
return int(result)
except ValueError:
return 0

return result

Expand Down
Loading