From 06a6b0d901590d6bcd55b1a03b8a25c6fde8934b Mon Sep 17 00:00:00 2001 From: Justin Jacobs Date: Mon, 17 Nov 2014 16:06:22 -0500 Subject: [PATCH] Fix off-by-one error when adding frames to Animations Also, close a FileParser that was left open in AnimationSet parsing. --- src/Animation.cpp | 2 +- src/AnimationSet.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Animation.cpp b/src/Animation.cpp index c2baa8d4a..cd043be61 100644 --- a/src/Animation.cpp +++ b/src/Animation.cpp @@ -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; diff --git a/src/AnimationSet.cpp b/src/AnimationSet.cpp index 2eb71ac8f..66322ddeb 100644 --- a/src/AnimationSet.cpp +++ b/src/AnimationSet.cpp @@ -177,6 +177,7 @@ void AnimationSet::load() { } _name = parser.section; } + parser.close(); if (!compressed_loading) { // add final animation