Check if action is nil before performing it.

This commit is contained in:
aditya-K2
2023-04-15 16:00:41 +05:30
parent fa069a00f4
commit db2f427304

View File

@@ -35,10 +35,13 @@ func (a *Action) SetRefreshable(r Refreshable) {
func (a *Action) Func() ActionFunc {
return func(e *tcell.EventKey) *tcell.EventKey {
val := a.f(e)
if a.refreshable != nil && val == nil {
a.refreshable.RefreshState()
if a != nil && a.f != nil {
val := a.f(e)
if a.refreshable != nil && val == nil {
a.refreshable.RefreshState()
}
return val
}
return val
return e
}
}