Add checks to ensure that the text received is valid.

This commit is contained in:
Joel Teichroeb 2011-05-26 11:00:50 -07:00
parent 1c2652424f
commit f925f95fa9
2 changed files with 7 additions and 2 deletions

View file

@ -168,7 +168,8 @@ void L1_BlastText() {
}
const char *line = lua_getstring(textObj);
Common::String text = line;
if (!line || line[0] == 0)
return;
TextObject *textObject = new TextObject(true);
textObject->setDefaults(&g_grim->_blastTextDefaults);
@ -176,7 +177,7 @@ void L1_BlastText() {
if (lua_istable(tableObj))
setTextObjectParams(textObject, tableObj);
textObject->setText(text.c_str());
textObject->setText(line);
textObject->draw();
delete textObject;
}

View file

@ -141,6 +141,10 @@ int TextObject::getTextCharPosition(int pos) {
void TextObject::setupText() {
Common::String msg = parseMsgText(_textID, NULL);
if (msg.size() == 0) {
_disabled = true;
return;
}
Common::String message;
const char *c = msg.c_str();