From 05fc63932bbd866dc73758452b67f83132a7a278 Mon Sep 17 00:00:00 2001 From: Sebastian Zaha Date: Mon, 31 Jul 2023 23:07:49 +0200 Subject: [PATCH] Ladybird: Fix JS console crash when history is empty Do not try to navigate JS console history forward when it is empty. A crash was occurring because of size_t underflow. --- Ladybird/ConsoleWidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Ladybird/ConsoleWidget.cpp b/Ladybird/ConsoleWidget.cpp index ddf5e09bf3..d92d05eb0f 100644 --- a/Ladybird/ConsoleWidget.cpp +++ b/Ladybird/ConsoleWidget.cpp @@ -175,6 +175,8 @@ void ConsoleInputEdit::keyPressEvent(QKeyEvent* event) { switch (event->key()) { case Qt::Key_Down: { + if (m_history.is_empty()) + break; auto last_index = m_history.size() - 1; if (m_history_index < last_index) { m_history_index++;