summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2021-07-14 22:33:17 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-07-15 09:21:55 +0200
commitb6e7fbf2e3e177ed8f9474152ed1cc419ecaf8b6 (patch)
tree6c0e72dd0df48f09bab96710204426b5a3f46e2b /app.go
parentMake buffers indexed, and refer to indexes with /BUFFER (diff)
Fix crash on disconnect
The crash was due to accessing app.s.Nick() when app.s was nil. This is a good opportunity to print a special prompt when disconnected: I chose `<offline>`, in red.
Diffstat (limited to 'app.go')
-rw-r--r--app.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/app.go b/app.go
index aa6a4c4..aed5249 100644
--- a/app.go
+++ b/app.go
@@ -811,6 +811,12 @@ func (app *App) updatePrompt() {
StyleDefault.
Foreground(tcell.Color(app.cfg.Colors.Prompt)),
)
+ } else if app.s == nil {
+ prompt = ui.Styled("<offline>",
+ tcell.
+ StyleDefault.
+ Foreground(tcell.ColorRed),
+ )
} else {
prompt = identString(app.s.Nick())
}