fix(cmd): check if state is nil (login screen)

This commit is contained in:
ayn2op 2025-01-11 12:18:50 -05:00
parent 24e2f65c44
commit f2d12b6a26

View file

@ -88,8 +88,10 @@ func (l *Layout) init() {
func (l *Layout) onAppInputCapture(event *tcell.EventKey) *tcell.EventKey {
switch event.Name() {
case l.cfg.Keys.Quit:
if err := discordState.Close(); err != nil {
slog.Error("failed to close the session", "err", err)
if discordState != nil {
if err := discordState.Close(); err != nil {
slog.Error("failed to close the session", "err", err)
}
}
l.app.Stop()