From fc6badcfb44da76ed49ca44b8cee3faef34e2570 Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Wed, 22 Apr 2026 22:51:54 +0200 Subject: [PATCH] we could arrive here with already destructed currentTerminalDisplay() avoid nullptr access BUG: 519274 --- src/Screen.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Screen.cpp b/src/Screen.cpp index 1b59c6151..eca9373af 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -2368,7 +2368,12 @@ void Screen::addHistLine() if (newHistLines <= oldHistLines) { _droppedLines += oldHistLines - newHistLines + 1; - currentTerminalDisplay()->removeLines(oldHistLines - newHistLines + 1); + // we could arrive here with already destructed currentTerminalDisplay() + // see bug 519274 + if (currentTerminalDisplay()) { + currentTerminalDisplay()->removeLines(oldHistLines - newHistLines + 1); + } + // We removed some lines, we need to verify if we need to remove a URL. if (_escapeSequenceUrlExtractor) { _escapeSequenceUrlExtractor->historyLinesRemoved(oldHistLines - newHistLines + 1);