Skip to content

Commit

Permalink
Handle absent course and speed attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkleffner authored and tkuester committed Sep 29, 2023
1 parent d98106f commit 65b627b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions taky/cot/models/takuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ def from_elm(elm, uid):
elif d_elm.tag == "status":
ret.battery = d_elm.get("battery")
elif d_elm.tag == "track":
ret.course = float(d_elm.get("course"))
ret.speed = float(d_elm.get("speed"))
course_attr = d_elm.get("course")
speed_attr = d_elm.get("speed")
if course_attr != None:
ret.course = float(course_attr)
if speed_attr != None:
ret.speed = float(speed_attr)

return ret

Expand Down

0 comments on commit 65b627b

Please sign in to comment.