From 22c1914a49fb0defbc4acf93729f2ab213b6b9da Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Wed, 11 Jul 2012 17:40:36 +0200 Subject: Prevented crash with nonexisting particle sprite. --- src/particleemitter.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index c4599233..a8b22e97 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -22,6 +22,7 @@ #include "animationparticle.h" #include "imageparticle.h" #include "log.h" +#include "map.h" #include "particle.h" #include "particleemitter.h" #include "rotationalparticle.h" @@ -30,7 +31,8 @@ #include "resources/image.h" #include "resources/imageset.h" #include "resources/resourcemanager.h" -#include "map.h" + +#include "utils/stringutils.h" #include @@ -267,12 +269,18 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, } else if (xmlStrEqual(propertyNode->name, BAD_CAST "animation")) { + std::string imagesetPath = + XML::getProperty(propertyNode, "imageset", ""); ImageSet *imageset = ResourceManager::getInstance()->getImageSet( - XML::getProperty(propertyNode, "imageset", ""), + imagesetPath, XML::getProperty(propertyNode, "width", 0), XML::getProperty(propertyNode, "height", 0) ); + if (!imageset) + logger->error(strprintf("Failed to load \"%s\"", + imagesetPath.c_str())); + // Get animation frames for_each_xml_child_node(frameNode, propertyNode) { -- cgit v1.2.3-70-g09d2