From 0007385a4733b1b2e7d73bb93d77c114f1a43dd8 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 29 Jun 2021 12:51:44 +0200
Subject: [PATCH 15/34] feedback: when not in curses mode, just skip displaying
 any message

Calling die() could trigger another call of emergency_save(), which
could fail and cause another call to statusline(), which would call
die() again...  Spiralling until stack space runs out.

This fixes https://savannah.gnu.org/bugs/?60853.

Bug existed since version 5.1, commit 7942dab0.

Original report was in https://bugzilla.redhat.com/1976410.
Reported-by: Souptik Dutta Roy <duttaroy.souptik@gmail.com>
---
 src/winio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/winio.c b/src/winio.c
index 906ea5b4..17ac9dad 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2076,8 +2076,9 @@ void statusline(message_type importance, const char *msg, ...)
 
 	UNSET(WHITESPACE_DISPLAY);
 
+	/* When not in curses mode, there is no status bar to display anything on. */
 	if (isendwin())
-		die("Out of curses -- please report a bug\n");
+		return;
 #endif
 
 	/* Ignore a message with an importance that is lower than the last one. */
-- 
2.29.3

