aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2008-05-11 13:11:01 +0000
committerFilippos Karapetis2008-05-11 13:11:01 +0000
commit57dfdbc6c865bfc804fd93b813982b9ca41931e4 (patch)
tree864f9e0b3d2dcfd17b3bc3132e9b8a3e940585d6 /engines
parent5f9c53344666cb4010665123d2badf7557018a3c (diff)
downloadscummvm-rg350-57dfdbc6c865bfc804fd93b813982b9ca41931e4.tar.gz
scummvm-rg350-57dfdbc6c865bfc804fd93b813982b9ca41931e4.tar.bz2
scummvm-rg350-57dfdbc6c865bfc804fd93b813982b9ca41931e4.zip
Added a sanity check to getFrame()
svn-id: r32020
Diffstat (limited to 'engines')
-rw-r--r--engines/made/resource.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/engines/made/resource.h b/engines/made/resource.h
index 7dcae8f381..cb6e0b65f4 100644
--- a/engines/made/resource.h
+++ b/engines/made/resource.h
@@ -81,7 +81,14 @@ public:
~AnimationResource();
void load(byte *source, int size);
int getCount() const { return _frames.size(); }
- Graphics::Surface *getFrame(int index) const { return _frames[index]; }
+ Graphics::Surface *getFrame(int index) const {
+ if ((uint)index < _frames.size()) {
+ return _frames[index];
+ } else {
+ warning("getFrame: Tried to obtain invalid frame %i, array has %i frames", index, _frames.size());
+ return _frames[_frames.size() - 1];
+ }
+ }
uint16 getFlags() const { return _flags; }
int16 getWidth() const { return _width; }
int16 getHeight() const { return _height; }