defensive nil checks around CanvasForObject
This commit is contained in:
@@ -152,7 +152,7 @@ func (b *BrowsingPane) doSetPage(p Page) bool {
|
||||
}
|
||||
// TODO: reset focus only if something inside the previous page had focus
|
||||
if c := fyne.CurrentApp().Driver().CanvasForObject(b); c != nil {
|
||||
c.Focus(nil)
|
||||
c.Unfocus()
|
||||
}
|
||||
b.curPage = p
|
||||
if np, ok := p.(CanShowNowPlaying); ok {
|
||||
|
||||
@@ -392,7 +392,9 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
|
||||
}
|
||||
buttonRow.Objects[3] = searchEntry
|
||||
searchEntry.SetMinWidth(minW)
|
||||
fyne.CurrentApp().Driver().CanvasForObject(a).Focus(searchEntry)
|
||||
if c := fyne.CurrentApp().Driver().CanvasForObject(a); c != nil {
|
||||
c.Focus(searchEntry)
|
||||
}
|
||||
fyne.NewAnimation(myTheme.AnimationDurationShort, func(f float32) {
|
||||
w := (200-minW)*f + minW
|
||||
searchEntry.SetMinWidth(w)
|
||||
|
||||
Reference in New Issue
Block a user