diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-16 18:21:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-16 18:21:50 +0300 |
commit | 05942467b37990f38fc80923f3d9ec63b160ad92 (patch) | |
tree | 3c6d3c3f55f83797d0a6444f1ddbd811267eb75d /src | |
parent | b6e4d73c64444efa7c7bd10f09926564457ac251 (diff) | |
download | manaverse-05942467b37990f38fc80923f3d9ec63b160ad92.tar.gz manaverse-05942467b37990f38fc80923f3d9ec63b160ad92.tar.bz2 manaverse-05942467b37990f38fc80923f3d9ec63b160ad92.tar.xz manaverse-05942467b37990f38fc80923f3d9ec63b160ad92.zip |
Add missing checks.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 11 | ||||
-rw-r--r-- | src/particle/particle.cpp | 16 | ||||
-rw-r--r-- | src/particle/particleemitter.cpp | 2 | ||||
-rw-r--r-- | src/resources/db/itemdb.cpp | 11 |
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; |