SWORD2: Add assert()s prompted by code analysis warnings.

See bug #3087857.

svn-id: r53509
This commit is contained in:
Torbjörn Andersson 2010-10-15 19:08:56 +00:00
parent cf8b589984
commit 10bd159d0d

View File

@ -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);