From 97c0b0c74a6bdb3eb6cc74266fad3bf908491529 Mon Sep 17 00:00:00 2001 From: Nong Van Tinh Date: Thu, 1 Sep 2022 01:26:08 +0700 Subject: [PATCH] Fixes #64962 that cause program run into infinite loop --- scene/gui/rich_text_label.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index c9a903153d6..61d91978a66 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -4622,7 +4622,10 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p queue_redraw(); return true; } - p_search_previous ? current_line-- : current_line++; + + if (current_line != ending_line) { + p_search_previous ? current_line-- : current_line++; + } } if (p_from_selection && selection.active) {