Skip to content

Commit

Permalink
Check for error immediately and skip publish if error occurred
Browse files Browse the repository at this point in the history
Signed-off-by: eleniums <[email protected]>
  • Loading branch information
eleniums authored and deadprogram committed May 22, 2019
1 parent 59cbea5 commit e415ef2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions platforms/dji/tello/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}()

Expand Down

0 comments on commit e415ef2

Please sign in to comment.