From 9d3c5cc012ec1f43ff7e070b80c6c5871aeca480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rosen?= Date: Sun, 3 Sep 2006 12:19:09 +0000 Subject: [PATCH] fix a WML crash when an else statement was the last in an animation --- src/unit_animation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/unit_animation.cpp b/src/unit_animation.cpp index 1609c653011..d736a120438 100644 --- a/src/unit_animation.cpp +++ b/src/unit_animation.cpp @@ -52,8 +52,8 @@ config unit_animation::prepare_animation(const config &cfg,const std::string ani expanded_chunk.append(*(*child).second); to_add.push_back(expanded_chunk); child++; - if(*(*child).first == "else") { - while(*(*child).first == "else") { + if(child != analyzed_anim.ordered_end() && *(*child).first == "else") { + while(child != analyzed_anim.ordered_end() && *(*child).first == "else") { expanded_chunk = expanded_anim; // add the content of else to the stored one expanded_chunk.append(*(*child).second); @@ -63,7 +63,7 @@ config unit_animation::prepare_animation(const config &cfg,const std::string ani } } else { - // add an animw with the if part removed + // add an anim with the if part removed to_add.push_back(expanded_anim); } // copy the end of the anim "as is" other if will be treated later