mirror of
https://github.com/rivo/tview.git
synced 2025-04-26 13:49:06 +08:00
Bufix in Pages: Avoid calling a nil function. Fixes #85
This commit is contained in:
parent
6e3b8a41c8
commit
87ba87feda
3
pages.go
3
pages.go
@ -217,6 +217,9 @@ func (p *Pages) HasFocus() bool {
|
|||||||
|
|
||||||
// Focus is called by the application when the primitive receives focus.
|
// Focus is called by the application when the primitive receives focus.
|
||||||
func (p *Pages) Focus(delegate func(p Primitive)) {
|
func (p *Pages) Focus(delegate func(p Primitive)) {
|
||||||
|
if delegate == nil {
|
||||||
|
return // We cannot delegate so we cannot focus.
|
||||||
|
}
|
||||||
p.setFocus = delegate
|
p.setFocus = delegate
|
||||||
var topItem Primitive
|
var topItem Primitive
|
||||||
for _, page := range p.pages {
|
for _, page := range p.pages {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user