summaryrefslogtreecommitdiffstats
path: root/scene/gui
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2024-11-12 20:40:47 +0100
committerkobewi <kobewi4e@gmail.com>2024-11-12 20:40:47 +0100
commit8437a05cc98200cd521bd695c42540da1eb5cdb8 (patch)
treed536e8034828e4c635afa2ef8ec627f85174dfea /scene/gui
parentcb411fa960f0b7fdbd97dcdb4c90f9346360ee0e (diff)
downloadredot-engine-8437a05cc98200cd521bd695c42540da1eb5cdb8.tar.gz
Ignore paste action if clipboard is empty
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 699277ba41..05e9b84bfa 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -7310,6 +7310,10 @@ void TextEdit::_paste_internal(int p_caret) {
}
String clipboard = DisplayServer::get_singleton()->clipboard_get();
+ if (clipboard.is_empty()) {
+ // Nothing to paste.
+ return;
+ }
// Paste a full line. Ignore '\r' characters that may have been added to the clipboard by the OS.
if (get_caret_count() == 1 && !has_selection(0) && !cut_copy_line.is_empty() && cut_copy_line == clipboard.replace("\r", "")) {