Fixed a crash in KQ1SCI, when the user types something wrong - the game tries to open a file with an empty file name, and an odd file mode

svn-id: r44491
This commit is contained in:
Filippos Karapetis 2009-09-30 15:43:28 +00:00
parent 1497f9845a
commit c76041d46d

View File

@ -753,6 +753,10 @@ reg_t kFileIO(EngineState *s, int argc, reg_t *argv) {
Common::String name = s->segMan->getString(argv[1]);
int mode = argv[2].toUint16();
if (name.empty()) {
warning("Attempted to open a file with an empty filename");
return make_reg(0, SIGNAL_OFFSET);
}
file_open(s, name.c_str(), mode);
debug(3, "K_FILEIO_OPEN(%s,0x%x)", name.c_str(), mode);
break;