diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-07-11 17:40:36 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-07-25 20:10:42 +0200 |
commit | 22c1914a49fb0defbc4acf93729f2ab213b6b9da (patch) | |
tree | 92273c0a3c58af8fd0896cf7c232ec7284338ec2 /src | |
parent | 995268b33ad305c68e340bdffd3b67322a659694 (diff) | |
download | mana-client-22c1914a49fb0defbc4acf93729f2ab213b6b9da.tar.gz mana-client-22c1914a49fb0defbc4acf93729f2ab213b6b9da.tar.bz2 mana-client-22c1914a49fb0defbc4acf93729f2ab213b6b9da.tar.xz mana-client-22c1914a49fb0defbc4acf93729f2ab213b6b9da.zip |
Prevented crash with nonexisting particle sprite.
Diffstat (limited to 'src')
-rw-r--r-- | src/particleemitter.cpp | 12 |
1 files 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 <cmath> @@ -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) { |