Navigation Menu

Skip to content

Commit

Permalink
Merge pull request flareteam#1270 from dorkster/fixes
Browse files Browse the repository at this point in the history
Fix off-by-one error when adding frames to Animations
  • Loading branch information
stefanbeller committed Nov 18, 2014
2 parents cdbc955 + 06a6b0d commit 5049bc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Animation.cpp
Expand Up @@ -119,7 +119,7 @@ void Animation::addFrame( unsigned short index,
Rect rect,
Point _render_offset) {

if (index > gfx.size()/max_kinds) {
if (index >= gfx.size()/max_kinds) {
logError("Animation: Animation(%s) adding rect(%d, %d, %d, %d) to frame index(%u) out of bounds. must be in [0, %d]\n",
name.c_str(), rect.x, rect.y, rect.w, rect.h, index, (int)gfx.size()/max_kinds);
return;
Expand Down
1 change: 1 addition & 0 deletions src/AnimationSet.cpp
Expand Up @@ -177,6 +177,7 @@ void AnimationSet::load() {
}
_name = parser.section;
}
parser.close();

if (!compressed_loading) {
// add final animation
Expand Down

0 comments on commit 5049bc1

Please sign in to comment.