~taiite/public-inbox

senpai: Fix crash on disconnect v1 APPLIED

delthas: 1
 Fix crash on disconnect

 1 files changed, 6 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~taiite/public-inbox/patches/23842/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH senpai] Fix crash on disconnect Export this patch

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.
---
 app.go | 6 ++++++
 1 file changed, 6 insertions(+)

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())
	}
-- 
2.30.0
Thanks for the catch, pushed!

I'm open to making the color configurable if someone wants to send
another patch for it.