From d0641a7528eb226f72c2ce7a2ee37322874966cb Mon Sep 17 00:00:00 2001 From: Xavier Sellier Date: Wed, 14 Feb 2018 23:52:35 -0500 Subject: [PATCH] Clear function made godot crashing because line_number is below 0 - Adding a MAX(0, index) in order to have at least 0 inserted in the history --- scene/gui/text_edit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index a1254464fdf..44d1fe9655a 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3212,7 +3212,7 @@ void TextEdit::_clear() { op.type = TextOperation::TYPE_CLEAR; op.from_line = 0; op.from_column = 0; - op.to_line = get_line_count() - 1; + op.to_line = MAX(0, get_line_count() - 1); op.to_column = get_line(op.to_line).length(); op.text = undo_text; op.version = ++version;