Add checks to ensure that the text received is valid.
This commit is contained in:
parent
1c2652424f
commit
f925f95fa9
2 changed files with 7 additions and 2 deletions
|
@ -168,7 +168,8 @@ void L1_BlastText() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *line = lua_getstring(textObj);
|
const char *line = lua_getstring(textObj);
|
||||||
Common::String text = line;
|
if (!line || line[0] == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
TextObject *textObject = new TextObject(true);
|
TextObject *textObject = new TextObject(true);
|
||||||
textObject->setDefaults(&g_grim->_blastTextDefaults);
|
textObject->setDefaults(&g_grim->_blastTextDefaults);
|
||||||
|
@ -176,7 +177,7 @@ void L1_BlastText() {
|
||||||
if (lua_istable(tableObj))
|
if (lua_istable(tableObj))
|
||||||
setTextObjectParams(textObject, tableObj);
|
setTextObjectParams(textObject, tableObj);
|
||||||
|
|
||||||
textObject->setText(text.c_str());
|
textObject->setText(line);
|
||||||
textObject->draw();
|
textObject->draw();
|
||||||
delete textObject;
|
delete textObject;
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,6 +141,10 @@ int TextObject::getTextCharPosition(int pos) {
|
||||||
|
|
||||||
void TextObject::setupText() {
|
void TextObject::setupText() {
|
||||||
Common::String msg = parseMsgText(_textID, NULL);
|
Common::String msg = parseMsgText(_textID, NULL);
|
||||||
|
if (msg.size() == 0) {
|
||||||
|
_disabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
Common::String message;
|
Common::String message;
|
||||||
const char *c = msg.c_str();
|
const char *c = msg.c_str();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue