Skip to content

Commit

Permalink
Don't crash when there is nothing to find
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jun 30, 2020
1 parent aac859c commit 44cf34f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wm/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import (
// FindObjectAtPixelPositionMatching looks for objects in the given canvas that are under pixel
// position at x, y. Objects must match the criteria in 'fn' and the first match will be returned.
func FindObjectAtPixelPositionMatching(x, y int, c fyne.Canvas, fn func(fyne.CanvasObject) bool) fyne.CanvasObject {
if c == nil {
return nil
}

pos := fyne.NewPos(unscaleInt(c, x), unscaleInt(c, y))
obj, _ := findObjectAtPositionMatching(pos, fn, c.Content())
return obj
Expand Down

0 comments on commit 44cf34f

Please sign in to comment.