diff options
author | rubidium <rubidium@openttd.org> | 2013-11-23 13:15:07 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-11-23 13:15:07 +0000 |
commit | 0e9c9921040a1d0e2aa4b820b20535f40a0d75a3 (patch) | |
tree | 6dd17568acbfb75610e9b4e248436426ead79e89 /src/script | |
parent | b3e93d65208f74802595b12e682d98a4d534a328 (diff) | |
download | openttd-0e9c9921040a1d0e2aa4b820b20535f40a0d75a3.tar.xz |
(svn r26058) -Fix: handle the return value of a number of functions better
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/squirrel.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp index 7c684d4b8..89b0b5625 100644 --- a/src/script/squirrel.cpp +++ b/src/script/squirrel.cpp @@ -493,7 +493,12 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer } func = _io_file_lexfeed_UTF8; break; - default: func = _io_file_lexfeed_ASCII; fseek(file, -2, SEEK_CUR); break; // ASCII + default: // ASCII + func = _io_file_lexfeed_ASCII; + if (fseek(file, -2, SEEK_CUR) < 0) { + return sq_throwerror(vm, _SC("cannot read the file")); + } + break; } if (SQ_SUCCEEDED(sq_compile(vm, func, &f, OTTD2SQ(filename), printerror))) { |