ソースを参照

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

ayn2op 1 年間 前
コミット
f2d12b6a26
1 ファイル変更4 行追加2 行削除
  1. 4 2
      cmd/layout.go

+ 4 - 2
cmd/layout.go

@@ -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()