Skip to content

Commit 0634dfd

Browse files
committed
handle ZeroDivisionError
1 parent aa66d0f commit 0634dfd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

adafruit_displayio_layout/widgets/switch_round.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,9 @@ def _animate_switch(self):
754754
# Determines the direction of movement, depending upon if the
755755
# switch is going from on->off or off->on
756756

757+
if self._animation_time == 0:
758+
self._draw_position(0)
759+
break
757760
# constrain the elapsed time
758761
elapsed_time = time.monotonic() - start_time
759762
if elapsed_time > self._animation_time:

0 commit comments

Comments
 (0)