Crash less hard if no webcam

This commit is contained in:
Martyn 2021-12-21 15:50:43 +00:00
parent 00067049ce
commit 955761e0a4
1 changed files with 4 additions and 1 deletions

View File

@ -56,7 +56,10 @@ func (r *gocvGocvWebcamRenderer) actualrenderframe(w, h int) image.Image {
gocvGocvWebcam, _ := gocv.VideoCaptureDevice(int(r.gocvGocvWebcam.GocvWebcamID))
img := gocv.NewMat()
gocvGocvWebcam.Read(&img)
frameImage, _ := img.ToImage() //no point doing anything other than returning anyway!
frameImage, err := img.ToImage()
if err != nil {
frameImage = image.NewRGBA(image.Rect(0, 0, w, h))
}
return frameImage
}