We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 217d6cf commit 8db59aaCopy full SHA for 8db59aa
robotgo.go
@@ -50,6 +50,7 @@ package robotgo
50
import "C"
51
52
import (
53
+ "errors"
54
"image"
55
"runtime"
56
"time"
@@ -366,11 +367,14 @@ func CaptureGo(args ...int) Bitmap {
366
367
}
368
369
// CaptureImg capture the screen and return image.Image
-func CaptureImg(args ...int) image.Image {
370
+func CaptureImg(args ...int) (image.Image, error) {
371
bit := CaptureScreen(args...)
372
+ if bit == nil {
373
+ return nil, errors.New("capture error")
374
+ }
375
defer FreeBitmap(bit)
376
- return ToImage(bit)
377
+ return ToImage(bit), nil
378
379
380
// FreeBitmap free and dealloc the C bitmap
0 commit comments