🐛 wrap land and streamoff calls in a try-catch in the end function to prevent raising an exception when the drone crashed (closes #126)

This commit is contained in:
Jakob Löw
2022-02-18 19:45:21 +01:00
parent 0636287fc6
commit 5c5848fd44

View File

@@ -993,10 +993,14 @@ class Tello:
def end(self):
"""Call this method when you want to end the tello object
"""
if self.is_flying:
self.land()
if self.stream_on:
self.streamoff()
try:
if self.is_flying:
self.land()
if self.stream_on:
self.streamoff()
except TelloException:
pass
if self.background_frame_read is not None:
self.background_frame_read.stop()