diff --git a/src/gui/interface/Label.cpp b/src/gui/interface/Label.cpp index f15733e7b..11512143b 100644 --- a/src/gui/interface/Label.cpp +++ b/src/gui/interface/Label.cpp @@ -215,6 +215,8 @@ void Label::copySelection() copyText = currentText.substr(selectionIndex0, selectionIndex1-selectionIndex0).c_str(); else if(selectionIndex0 > selectionIndex1) copyText = currentText.substr(selectionIndex1, selectionIndex0-selectionIndex1).c_str(); + else if (!currentText.length()) + return; else copyText = currentText.c_str(); ClipboardPush(format::CleanString(copyText, false, true, false)); diff --git a/src/gui/interface/Textbox.cpp b/src/gui/interface/Textbox.cpp index 6c0c0732b..fe646421e 100644 --- a/src/gui/interface/Textbox.cpp +++ b/src/gui/interface/Textbox.cpp @@ -146,8 +146,11 @@ void Textbox::cutSelection() } else { + if (!backingText.length()) + return; ClipboardPush(format::CleanString(backingText, false, true, false)); backingText.clear(); + cursor = 0; } ClearSelection();