aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-09-30 15:43:28 +0000
committerFilippos Karapetis2009-09-30 15:43:28 +0000
commitc76041d46d82215ff59f885d3bd089d602e493cf (patch)
treef4d4ab9e70665699b2eb5d00ca558d127992c460 /engines/sci
parent1497f9845a860e2d1ab6a6a5b418233239af427b (diff)
downloadscummvm-rg350-c76041d46d82215ff59f885d3bd089d602e493cf.tar.gz
scummvm-rg350-c76041d46d82215ff59f885d3bd089d602e493cf.tar.bz2
scummvm-rg350-c76041d46d82215ff59f885d3bd089d602e493cf.zip
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
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kfile.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 75844f4b38..bdad29efe7 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -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;