aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTorbjörn Andersson2010-10-15 19:08:56 +0000
committerTorbjörn Andersson2010-10-15 19:08:56 +0000
commit10bd159d0dfe4238c4df379b1740d098ce8dfa31 (patch)
tree90e16d42cf30214ab8512717c1084cab0ad32dce /engines
parentcf8b58998417b6735b8e69b9cd4673a3c3204f34 (diff)
downloadscummvm-rg350-10bd159d0dfe4238c4df379b1740d098ce8dfa31.tar.gz
scummvm-rg350-10bd159d0dfe4238c4df379b1740d098ce8dfa31.tar.bz2
scummvm-rg350-10bd159d0dfe4238c4df379b1740d098ce8dfa31.zip
SWORD2: Add assert()s prompted by code analysis warnings.
See bug #3087857. svn-id: r53509
Diffstat (limited to 'engines')
-rw-r--r--engines/sword2/resman.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/engines/sword2/resman.cpp b/engines/sword2/resman.cpp
index 1b2411a404..fa9c396ef3 100644
--- a/engines/sword2/resman.cpp
+++ b/engines/sword2/resman.cpp
@@ -302,6 +302,8 @@ byte *ResourceManager::openResource(uint32 res, bool dump) {
readCluIndex(cluFileNum, file);
}
+ assert(_resFiles[cluFileNum].entryTab);
+
uint32 pos = _resFiles[cluFileNum].entryTab[actual_res * 2 + 0];
uint32 len = _resFiles[cluFileNum].entryTab[actual_res * 2 + 1];
@@ -476,6 +478,9 @@ void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) {
assert((tableSize % 8) == 0);
_resFiles[fileNum].entryTab = (uint32 *)malloc(tableSize);
_resFiles[fileNum].numEntries = tableSize / 8;
+
+ assert(_resFiles[fileNum].entryTab);
+
file->read(_resFiles[fileNum].entryTab, tableSize);
if (file->eos() || file->err())
error("unable to read index table from file %s", _resFiles[fileNum].fileName);