diff options
-rw-r--r-- | graphics/macgui/mactextwindow.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp index a45d1d641b..9a1898b044 100644 --- a/graphics/macgui/mactextwindow.cpp +++ b/graphics/macgui/mactextwindow.cpp @@ -257,9 +257,12 @@ Common::String MacTextWindow::cutSelection() { const char *selStart = strstr(_inputText.c_str(), selection.c_str()); - if (!selStart) + if (!selStart) { warning("Cannot find substring '%s' in '%s'", selection.c_str(), _inputText.c_str()); + return Common::String(""); + } + int selPos = selStart - _inputText.c_str(); _inputText = Common::String(_inputText.c_str(), selPos) + Common::String(_inputText.c_str() + selPos + selection.size()); |