[Scummvm-cvs-logs] SF.net SVN: scummvm: [32020] scummvm/trunk/engines/made/resource.h

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun May 11 15:11:01 CEST 2008


Revision: 32020
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32020&view=rev
Author:   thebluegr
Date:     2008-05-11 06:11:01 -0700 (Sun, 11 May 2008)

Log Message:
-----------
Added a sanity check to getFrame()

Modified Paths:
--------------
    scummvm/trunk/engines/made/resource.h

Modified: scummvm/trunk/engines/made/resource.h
===================================================================
--- scummvm/trunk/engines/made/resource.h	2008-05-11 12:58:54 UTC (rev 32019)
+++ scummvm/trunk/engines/made/resource.h	2008-05-11 13:11:01 UTC (rev 32020)
@@ -81,7 +81,14 @@
 	~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; }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list