Skip to content

Commit

Permalink
Merge pull request #13 from discoverkl/master
Browse files Browse the repository at this point in the history
fix panic while no display is active
  • Loading branch information
kbinani committed Jun 12, 2019
2 parents 14f7672 + db2ca2f commit c3c7d93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion screenshot_darwin.go
Expand Up @@ -207,7 +207,7 @@ func createColorspace() C.CGColorSpaceRef {
func activeDisplayList() []C.CGDirectDisplayID {
count := C.uint32_t(NumActiveDisplays())
ret := make([]C.CGDirectDisplayID, count)
if C.CGGetActiveDisplayList(count, (*C.CGDirectDisplayID)(unsafe.Pointer(&ret[0])), nil) == C.kCGErrorSuccess {
if count > 0 && C.CGGetActiveDisplayList(count, (*C.CGDirectDisplayID)(unsafe.Pointer(&ret[0])), nil) == C.kCGErrorSuccess {
return ret
} else {
return make([]C.CGDirectDisplayID, 0)
Expand Down

0 comments on commit c3c7d93

Please sign in to comment.