diff options
author | lupoDharkael <izhe@hotmail.es> | 2018-09-30 17:17:29 +0200 |
---|---|---|
committer | lupoDharkael <izhe@hotmail.es> | 2018-09-30 17:17:29 +0200 |
commit | f5f948210c584eb6599c097ce5fbeb9990f78cc7 (patch) | |
tree | eae0c18e091935fce5f12cb94903dbb23d6a860d /scene/gui | |
parent | c432ce4ee15fc396b2bccbbe2661b5bd34b9bee1 (diff) |
TextEdit: prevent the copy of an empty string
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index a9566d9387..c61bb25fb9 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4547,9 +4547,13 @@ void TextEdit::cut() { void TextEdit::copy() { if (!selection.active) { - String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length()); - OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = clipboard; + + if (text[cursor.line].length() != 0) { + + String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length()); + OS::get_singleton()->set_clipboard(clipboard); + cut_copy_line = clipboard; + } } else { String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column); OS::get_singleton()->set_clipboard(clipboard); |