defensive nil checks around CanvasForObject

This commit is contained in:
Drew Weymouth
2026-03-01 08:24:16 -08:00
parent 12b5d33bbe
commit afb1c6c397
8 changed files with 30 additions and 13 deletions
+3 -1
View File
@@ -50,7 +50,9 @@ func (sf *SearchEntry) Init() {
func (s *SearchEntry) TypedKey(e *fyne.KeyEvent) {
if e.Name == fyne.KeyEscape {
s.SetText("")
fyne.CurrentApp().Driver().CanvasForObject(s).Unfocus()
if c := fyne.CurrentApp().Driver().CanvasForObject(s); c != nil {
c.Unfocus()
}
return
}
s.Entry.TypedKey(e)