Skip to content

Commit

Permalink
Prevent panic in Xorg.active
Browse files Browse the repository at this point in the history
If the returned value can't be decoded, return x.root.

Fixes #6.
  • Loading branch information
muesli committed Feb 5, 2021
1 parent fe7429d commit e8572a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion desktop_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (x Xorg) property(w xproto.Window, a *xproto.InternAtomReply) (*xproto.GetP

func (x Xorg) active() xproto.Window {
p, err := x.property(x.root, x.activeAtom)
if err != nil {
if err != nil || len(p.Value) == 0 {
return x.root
}
return xproto.Window(xgb.Get32(p.Value))
Expand Down

0 comments on commit e8572a6

Please sign in to comment.