summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/serverdialog.cpp11
-rw-r--r--src/particle/particle.cpp16
-rw-r--r--src/particle/particleemitter.cpp2
-rw-r--r--src/resources/db/itemdb.cpp11
4 files changed, 31 insertions, 9 deletions
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 30b4e600e..035a98a10 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -531,9 +531,14 @@ void ServerDialog::loadServers(const bool addNew)
server.port = defaultPortForServerType(server.type);
}
}
- else if ((xmlNameEqual(subNode, "description")
- && server.description.empty()) || (!lang.empty()
- && xmlNameEqual(subNode, description2.c_str())))
+ else if (!subNode->xmlChildrenNode)
+ {
+ continue;
+ }
+
+ if ((xmlNameEqual(subNode, "description")
+ && server.description.empty()) || (!lang.empty()
+ && xmlNameEqual(subNode, description2.c_str())))
{
server.description = reinterpret_cast<const char*>(
subNode->xmlChildrenNode->content);
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index ed8db2d27..2ad4fe728 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -329,8 +329,12 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
// Image
else if ((node = XML::findFirstChildByName(effectChildNode, "image")))
{
- std::string imageSrc = reinterpret_cast<const char*>(
- node->xmlChildrenNode->content);
+ std::string imageSrc;
+ if (node->xmlChildrenNode)
+ {
+ imageSrc = reinterpret_cast<const char*>(
+ node->xmlChildrenNode->content);
+ }
if (!imageSrc.empty() && !dyePalettes.empty())
Dye::instantiate(imageSrc, dyePalettes);
Image *const img = resman->getImage(imageSrc);
@@ -375,8 +379,12 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
}
else if (xmlNameEqual(emitterNode, "deatheffect"))
{
- const std::string deathEffect = reinterpret_cast<const char*>(
- emitterNode->xmlChildrenNode->content);
+ std::string deathEffect;
+ if (node->xmlChildrenNode)
+ {
+ deathEffect = reinterpret_cast<const char*>(
+ emitterNode->xmlChildrenNode->content);
+ }
char deathEffectConditions = 0x00;
if (XML::getBoolProperty(emitterNode, "on-floor", true))
diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp
index 496372a64..38462aeb6 100644
--- a/src/particle/particleemitter.cpp
+++ b/src/particle/particleemitter.cpp
@@ -322,6 +322,8 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtrConst emitterNode,
}
else if (xmlNameEqual(propertyNode, "deatheffect"))
{
+ if (!propertyNode->xmlChildrenNode)
+ continue;
mDeathEffect = reinterpret_cast<const char*>(
propertyNode->xmlChildrenNode->content);
mDeathEffectConditions = 0x00;
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index f4e4116ac..9d9550e82 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -431,8 +431,11 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
}
else if (xmlNameEqual(itemChild, "particlefx"))
{
- display.particles.push_back(reinterpret_cast<const char*>(
- itemChild->xmlChildrenNode->content));
+ if (itemChild->xmlChildrenNode)
+ {
+ display.particles.push_back(reinterpret_cast<const char*>(
+ itemChild->xmlChildrenNode->content));
+ }
}
else if (xmlNameEqual(itemChild, "sound"))
{
@@ -745,6 +748,8 @@ static void loadSpriteRef(ItemInfo *const itemInfo, const XmlNodePtr node)
static void loadSoundRef(ItemInfo *const itemInfo, const XmlNodePtr node)
{
+ if (!node->xmlChildrenNode)
+ return;
const std::string event = XML::getProperty(node, "event", "");
const std::string filename = reinterpret_cast<const char*>(
node->xmlChildrenNode->content);
@@ -768,6 +773,8 @@ static void loadFloorSprite(SpriteDisplay *const display,
{
for_each_xml_child_node(spriteNode, floorNode)
{
+ if (!spriteNode->xmlChildrenNode)
+ continue;
if (xmlNameEqual(spriteNode, "sprite"))
{
SpriteReference *const currentSprite = new SpriteReference;