Skip to content

Commit 2d7881f

Browse files
committed
delay_ms.py: Fix for issue 98.
1 parent c0dcaca commit 2d7881f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

v3/primitives/delay_ms.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def callback(self, func=None, args=()):
7575
self._args = args
7676

7777
def deinit(self):
78-
self.stop()
79-
self._mtask.cancel()
80-
self._mtask = None
78+
if self._mtask is not None: # https://github.com/peterhinch/micropython-async/issues/98
79+
self.stop()
80+
self._mtask.cancel()
81+
self._mtask = None

0 commit comments

Comments
 (0)