aboutsummaryrefslogtreecommitdiff
path: root/engines/m4
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-23 11:22:44 +0000
committerFilippos Karapetis2010-06-23 11:22:44 +0000
commit3569b496622a61eb7d82c3033b188c4cd0426ae6 (patch)
treef12830f82592ad0f537cb3be9f70c973a14b0e91 /engines/m4
parent717005bf25b6e74f22418324845f363eb4a1068d (diff)
downloadscummvm-rg350-3569b496622a61eb7d82c3033b188c4cd0426ae6.tar.gz
scummvm-rg350-3569b496622a61eb7d82c3033b188c4cd0426ae6.tar.bz2
scummvm-rg350-3569b496622a61eb7d82c3033b188c4cd0426ae6.zip
Changed some asserts to warnings
svn-id: r50175
Diffstat (limited to 'engines/m4')
-rw-r--r--engines/m4/assets.cpp7
-rw-r--r--engines/m4/graphics.cpp6
-rw-r--r--engines/m4/sprite.cpp5
3 files changed, 14 insertions, 4 deletions
diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp
index 1f3cf278ae..c329373add 100644
--- a/engines/m4/assets.cpp
+++ b/engines/m4/assets.cpp
@@ -320,7 +320,12 @@ void SpriteAsset::loadFrameHeader(SpriteAssetFrame &frameHeader, bool isBigEndia
}
M4Sprite *SpriteAsset::getFrame(int frameIndex) {
- return _frames[frameIndex].frame;
+ if ((uint)frameIndex < _frames.size()) {
+ return _frames[frameIndex].frame;
+ } else {
+ warning("SpriteAsset::getFrame: Invalid frame %d, out of %d", frameIndex, _frames.size());
+ return _frames[_frames.size() - 1].frame;
+ }
}
void SpriteAsset::loadStreamingFrame(M4Sprite *frame, int frameIndex, int destX, int destY) {
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index b0bc8bbc0c..85d138328d 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -920,8 +920,10 @@ void M4Surface::translate(RGBList *list, bool isTransparent) {
for (int i = 0; i < width() * height(); ++i, ++p) {
if (!isTransparent || (*p != TRANSPARENT_COLOUR_INDEX)) {
- assert(*p < list->size());
- *p = palIndexes[*p];
+ if (*p < list->size()) {
+ warning("Pal pointer exceeds list size");
+ *p = palIndexes[*p];
+ }
}
}
diff --git a/engines/m4/sprite.cpp b/engines/m4/sprite.cpp
index 553b27dd9a..55de6714d1 100644
--- a/engines/m4/sprite.cpp
+++ b/engines/m4/sprite.cpp
@@ -182,7 +182,10 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) {
// Check if we need to scan forward to find the end of the line
if (!newLine) {
do {
- assert(!source->eos());
+ if (source->eos()) {
+ warning("M4Sprite::loadMadsSprite: unexpected end of data");
+ break;
+ }
} while (source->readByte() != 0xff);
}
}