summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-08-31 13:41:45 +0200
committerGitHub <noreply@github.com>2020-08-31 13:41:45 +0200
commita70038293cb583d2f51d08f20db1b0a230392c14 (patch)
tree1a6635e4dbbfb512e4ce2f0cf363d71a00800580 /scene
parentbb724ffd0276544f5eef0441bf3f9a8e771784c4 (diff)
parent71febfd6e2f6187fcc106ce715124cf173bfa0b8 (diff)
Merge pull request #41520 from Tony-Goat/patch-1
Added string length checking to LineEdit.set_text()
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/line_edit.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 14167531a5..162949fd69 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -1281,7 +1281,12 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) {
void LineEdit::set_text(String p_text) {
clear_internal();
- append_at_cursor(p_text);
+
+ if (p_text.length() > max_length) {
+ append_at_cursor(p_text.substr(0, max_length));
+ } else {
+ append_at_cursor(p_text);
+ }
if (expand_to_text_length) {
minimum_size_changed();