fix(chat): move state nil check outside Cmd func
This commit is contained in:
parent
99e9481a72
commit
bf77f67c5b
1 changed files with 5 additions and 5 deletions
|
|
@ -20,12 +20,12 @@ func (m *Model) openState() tview.Cmd {
|
|||
}
|
||||
|
||||
func (m *Model) closeState() tview.Cmd {
|
||||
if m.state == nil {
|
||||
return nil
|
||||
}
|
||||
return func() tview.Msg {
|
||||
if m.state != nil {
|
||||
if err := m.state.Close(); err != nil {
|
||||
slog.Error("failed to close the session", "err", err)
|
||||
return nil
|
||||
}
|
||||
if err := m.state.Close(); err != nil {
|
||||
slog.Error("failed to close the session", "err", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue