mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 23:18:44 +00:00
GRAPHICS: MACGUI: Fix crash in selection when there is no text found
This commit is contained in:
parent
0f0dd88b61
commit
b9a7f2c800
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user