mirror of
https://github.com/damiafuentes/DJITelloPy.git
synced 2024-10-25 03:27:46 +03:00
🐛 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:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user