diff options
Diffstat (limited to 'engines/made/resource.h')
-rw-r--r-- | engines/made/resource.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/engines/made/resource.h b/engines/made/resource.h index be85561318..cb6e0b65f4 100644 --- a/engines/made/resource.h +++ b/engines/made/resource.h @@ -35,7 +35,7 @@ namespace Made { -const int kMaxResourceCacheCount = 200; +const int kMaxResourceCacheCount = 100; enum ResourceType { kResARCH = MKID_BE('ARCH'), @@ -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; } |