Skip to content

Commit e8572a6

Browse files
committed
Prevent panic in Xorg.active
If the returned value can't be decoded, return x.root. Fixes #6.
1 parent fe7429d commit e8572a6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

desktop_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (x Xorg) property(w xproto.Window, a *xproto.InternAtomReply) (*xproto.GetP
167167

168168
func (x Xorg) active() xproto.Window {
169169
p, err := x.property(x.root, x.activeAtom)
170-
if err != nil {
170+
if err != nil || len(p.Value) == 0 {
171171
return x.root
172172
}
173173
return xproto.Window(xgb.Get32(p.Value))

0 commit comments

Comments
 (0)