summaryrefslogtreecommitdiff
path: root/src/particleemitter.cpp
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2012-07-11 17:40:36 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2012-07-25 20:10:42 +0200
commit22c1914a49fb0defbc4acf93729f2ab213b6b9da (patch)
tree92273c0a3c58af8fd0896cf7c232ec7284338ec2 /src/particleemitter.cpp
parent995268b33ad305c68e340bdffd3b67322a659694 (diff)
downloadmana-22c1914a49fb0defbc4acf93729f2ab213b6b9da.tar.gz
mana-22c1914a49fb0defbc4acf93729f2ab213b6b9da.tar.bz2
mana-22c1914a49fb0defbc4acf93729f2ab213b6b9da.tar.xz
mana-22c1914a49fb0defbc4acf93729f2ab213b6b9da.zip
Prevented crash with nonexisting particle sprite.
Diffstat (limited to 'src/particleemitter.cpp')
-rw-r--r--src/particleemitter.cpp12
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)
{