Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slice bounds out of range panic when stopping Tello drone #631

merged 1 commit into from Oct 11, 2018


Copy link

@eleniums eleniums commented Oct 9, 2018

Most of the time when stopping my DJI Tello drone, I was getting this panic:

panic: runtime error: slice bounds out of range

goroutine 50 [running]:*Driver).processVideo.func1(0xc4200d2000)
	/Users/snelson/go/src/ +0x24e
created by*Driver).processVideo
	/Users/snelson/go/src/ +0xe3
exit status 2

I noticed the driver was trying to publish a VideoFrameEvent before checking for an error from the read UDP operation. This commit moves the error check to immediately after the read operation and continues if an error occurred. This avoids trying to slice an empty buffer and dodges a panic.

Signed-off-by: eleniums <>
Copy link

codecov bot commented Oct 9, 2018

Codecov Report

Merging #631 into dev will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #631      +/-   ##
- Coverage   77.73%   77.72%   -0.01%     
  Files         157      157              
  Lines       10672    10673       +1     
  Hits         8296     8296              
- Misses       1928     1929       +1     
  Partials      448      448
Impacted Files Coverage Δ
platforms/dji/tello/driver.go 25.65% <0%> (-0.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f3b295...e23c01d. Read the comment docs.

Copy link
Contributor Author

Do I need to increase code coverage in order for this pull request to be addressed and accepted?

Copy link

Hi, @eleniums thank you very much for this PR. Test coverage would be nice, certainly, but the coverage in this platform is not very high to begin with. In any case, now merging, as I need this myself! Thanks again.

@deadprogram deadprogram merged commit d0f5ba5 into hybridgroup:dev Oct 11, 2018
@eleniums eleniums deleted the fix/tello-read-udp-panic branch October 12, 2018 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants