From e415ef235a93ded83c6b4064a1c2413e145b832c Mon Sep 17 00:00:00 2001 From: eleniums Date: Mon, 8 Oct 2018 23:16:23 -0700 Subject: [PATCH] Check for error immediately and skip publish if error occurred Signed-off-by: eleniums --- platforms/dji/tello/driver.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platforms/dji/tello/driver.go b/platforms/dji/tello/driver.go index 6fbb30dcd..b391700aa 100644 --- a/platforms/dji/tello/driver.go +++ b/platforms/dji/tello/driver.go @@ -817,11 +817,12 @@ func (d *Driver) processVideo() error { for { buf := make([]byte, 2048) n, _, err := d.videoConn.ReadFromUDP(buf) - d.Publish(d.Event(VideoFrameEvent), buf[2:n]) - if err != nil { fmt.Println("Error: ", err) + continue } + + d.Publish(d.Event(VideoFrameEvent), buf[2:n]) } }()