aboutsummaryrefslogtreecommitdiff
path: root/engines/made/resource.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/made/resource.h')
-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; }