diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-17 02:48:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-17 02:48:54 +0300 |
commit | 53cc3c86f2b5040cec577145feff9db2c93bd268 (patch) | |
tree | 44d3d91d85d9c10fbb8aa5636b0e72ebfea0c76f | |
parent | 26f2c689298bb2077000b81ff3fe14328a89feb8 (diff) | |
download | plus-53cc3c86f2b5040cec577145feff9db2c93bd268.tar.gz plus-53cc3c86f2b5040cec577145feff9db2c93bd268.tar.bz2 plus-53cc3c86f2b5040cec577145feff9db2c93bd268.tar.xz plus-53cc3c86f2b5040cec577145feff9db2c93bd268.zip |
Fix some issues after automatic checks.
-rw-r--r-- | src/actions/actions.cpp | 20 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_relations.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/killstats.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/chathandler.cpp | 19 | ||||
-rw-r--r-- | src/particle/particle.cpp | 4 |
9 files changed, 41 insertions, 27 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index d2905a27e..7121b138d 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -639,6 +639,9 @@ impHandler(buy) return false; } + if (!being) + return false; + if (being->getType() == ActorType::Npc) { npcHandler->buy(being->getId()); @@ -672,6 +675,9 @@ impHandler(sell) return false; } + if (!being) + return false; + if (being->getType() == ActorType::Npc) { npcHandler->sell(being->getId()); @@ -696,15 +702,11 @@ impHandler(talk) if (!being) return false; - if (being) - { - if (being->canTalk()) - being->talkTo(); - else if (being->getType() == ActorType::Player) - new BuySellDialog(being->getName()); - return true; - } - return false; + if (being->canTalk()) + being->talkTo(); + else if (being->getType() == ActorType::Player) + new BuySellDialog(being->getName()); + return true; } impHandler0(stopAttack) diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 78f4fd475..4f00d6050 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1236,7 +1236,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "priority movedown") { - if (localPlayer) + if (localPlayer && actorManager) { const int idx = actorManager ->getPriorityAttackMobIndex(mNick); diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index dbfc068e6..2be152d4a 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -777,6 +777,8 @@ void TabbedArea::selectPrevTab() if (tab == 0) tab = static_cast<int>(mTabs.size()); + if (tab < 0) + return; tab--; setSelectedTab(mTabs[tab].first); } diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index 4b8be484c..ffa5e1a66 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -216,9 +216,11 @@ void Setup_Relations::action(const ActionEvent &event) } else if (eventId == ACTION_STRATEGY) { + const int sel = mIgnoreActionChoicesBox->getSelected(); + if (sel < 0) + return; PlayerIgnoreStrategy *const s = - (*player_relations.getPlayerIgnoreStrategies())[ - mIgnoreActionChoicesBox->getSelected()]; + (*player_relations.getPlayerIgnoreStrategies())[sel]; player_relations.setPlayerIgnoreStrategy(s); } diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index c87fe3ebc..9a99937d5 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -148,8 +148,12 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mSortDropDown->setSelected(0); } - if (setupWindow && inventory->getType() != InventoryType::STORAGE) + if (setupWindow && + inventory && + inventory->getType() != InventoryType::STORAGE) + { setupWindow->registerWindowForReset(this); + } setResizable(true); setCloseButton(true); diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index efb0ea0df..919b11e9a 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -216,7 +216,8 @@ void KillStats::gainXp(int xp) if (!mKillCounter) mKillCounter = 1; - const float AvgExp = static_cast<float>(mExpCounter / mKillCounter); + const float AvgExp = static_cast<float>(mExpCounter) + / static_cast<float>(mKillCounter); int xpNextLevel(expNeed); if (mKillTimer == 0) @@ -348,7 +349,7 @@ void KillStats::update() mExpTime1Label->setCaption(strprintf(_(" Time for next level: %s"), toString(static_cast<float>((PlayerInfo::getAttribute( Attributes::EXP_NEEDED) - PlayerInfo::getAttribute( - Attributes::EXP)) / m1minSpeed)).c_str())); + Attributes::EXP)) / static_cast<float>(m1minSpeed))).c_str())); } else { diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 10a5f987b..20cafc2c6 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -661,6 +661,8 @@ void SkillDialog::playCastingDstEffect(const int id, Being *const being) const void SkillDialog::useSkill(const SkillInfo *const info) { + if (!info) + return; const SkillData *const data = info->data; if (data) { @@ -668,7 +670,7 @@ void SkillDialog::useSkill(const SkillInfo *const info) if (!cmd.empty()) SpellManager::invokeCommand(cmd, localPlayer->getTarget()); } - if (info && localPlayer) + if (localPlayer) { switch (info->type) { diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 07ed7e390..872afe05e 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -697,19 +697,20 @@ void ChatHandler::processChatRoomJoinAck(Net::MessageIn &msg) } ChatObject *oldChat = ChatObject::findById(id); - if (!oldChat) - oldChat = new ChatObject; PlayerInfo::setRoomName(oldChat->title); chatWindow->joinRoom(true); ChatObject *const obj = new ChatObject; - obj->ownerId = oldChat->ownerId; - obj->chatId = oldChat->chatId; - obj->maxUsers = oldChat->maxUsers; - obj->currentUsers = oldChat->currentUsers; - obj->type = oldChat->type; - obj->title = oldChat->title; -// obj->update(); + if (oldChat) + { + obj->ownerId = oldChat->ownerId; + obj->chatId = oldChat->chatId; + obj->maxUsers = oldChat->maxUsers; + obj->currentUsers = oldChat->currentUsers; + obj->type = oldChat->type; + obj->title = oldChat->title; +// obj->update(); + } localPlayer->setChat(obj); } diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 08131cd23..f270dcc79 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -330,7 +330,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, else if ((node = XML::findFirstChildByName(effectChildNode, "image"))) { std::string imageSrc; - if (node->xmlChildrenNode) + if (node && node->xmlChildrenNode) { imageSrc = reinterpret_cast<const char*>( node->xmlChildrenNode->content); @@ -380,7 +380,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, else if (xmlNameEqual(emitterNode, "deatheffect")) { std::string deathEffect; - if (node->xmlChildrenNode) + if (node && node->xmlChildrenNode) { deathEffect = reinterpret_cast<const char*>( emitterNode->xmlChildrenNode->content); |