summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-12 03:13:01 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-12 03:13:01 +0300
commit0e1d656e85e1bbc80e9e8adcfb2c07a8bc0d4bb8 (patch)
tree5b537fe44b0753ced7c6f9fd1aa916604c178f2f /src/net
parent8be2905d29db5013bf8a2d9c5c7c7155af77ed49 (diff)
downloadplus-0e1d656e85e1bbc80e9e8adcfb2c07a8bc0d4bb8.tar.gz
plus-0e1d656e85e1bbc80e9e8adcfb2c07a8bc0d4bb8.tar.bz2
plus-0e1d656e85e1bbc80e9e8adcfb2c07a8bc0d4bb8.tar.xz
plus-0e1d656e85e1bbc80e9e8adcfb2c07a8bc0d4bb8.zip
Fix code style. Add missing actorManager null checks.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/beingrecv.cpp2
-rw-r--r--src/net/eathena/battlegroundrecv.cpp2
-rw-r--r--src/net/eathena/beingrecv.cpp17
-rw-r--r--src/net/eathena/buyingstorerecv.cpp6
-rw-r--r--src/net/eathena/chatrecv.cpp12
-rw-r--r--src/net/eathena/clanhandler.h1
-rw-r--r--src/net/eathena/clanrecv.cpp1
-rw-r--r--src/net/eathena/homunculusrecv.cpp4
-rw-r--r--src/net/eathena/mercenaryrecv.cpp2
-rw-r--r--src/net/eathena/npcrecv.cpp2
-rw-r--r--src/net/eathena/partyhandler.cpp2
-rw-r--r--src/net/eathena/petrecv.cpp2
-rw-r--r--src/net/eathena/playerrecv.cpp2
-rw-r--r--src/net/eathena/vendingrecv.cpp6
14 files changed, 56 insertions, 5 deletions
diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp
index 637fccd8b..3b09502f4 100644
--- a/src/net/ea/beingrecv.cpp
+++ b/src/net/ea/beingrecv.cpp
@@ -381,6 +381,8 @@ void BeingRecv::processPlayerMoveToAttack(Net::MessageIn &msg)
void BeingRecv::processSkillNoDamage(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const int id = msg.readInt16("skill id");
int heal;
if (msg.getVersion() >= 20131223)
diff --git a/src/net/eathena/battlegroundrecv.cpp b/src/net/eathena/battlegroundrecv.cpp
index 5ee99d38d..5ee51251e 100644
--- a/src/net/eathena/battlegroundrecv.cpp
+++ b/src/net/eathena/battlegroundrecv.cpp
@@ -42,6 +42,8 @@ void BattleGroundRecv::processBattleEmblem(Net::MessageIn &msg)
void BattleGroundRecv::processBattleEmblem2(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const BeingId id = msg.readBeingId("account id");
msg.readString(24, "name");
msg.readInt16("bg id");
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index a9b7aa7f8..f2b02b05c 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -1066,7 +1066,8 @@ void BeingRecv::processSkillCastingContinue(Net::MessageIn &msg,
const SkillType2::SkillType2 inf2,
const int castTime)
{
- if (effectManager == nullptr)
+ if (effectManager == nullptr ||
+ actorManager == nullptr)
return;
if (srcId == BeingId_zero)
@@ -1301,6 +1302,8 @@ void BeingRecv::processBeingAction2(Net::MessageIn &msg)
void BeingRecv::processBeingHp(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
Being *const dstBeing = actorManager->findBeing(
msg.readBeingId("being id"));
int hp;
@@ -1324,6 +1327,8 @@ void BeingRecv::processBeingHp(Net::MessageIn &msg)
void BeingRecv::processMonsterHp(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
Being *const dstBeing = actorManager->findBeing(
msg.readBeingId("monster id"));
const int hp = msg.readInt32("hp");
@@ -1696,6 +1701,8 @@ void BeingRecv::processBeingStatUpdate1(Net::MessageIn &msg)
const int type = msg.readInt16("type");
const int value = msg.readInt32("value");
+ if (actorManager == nullptr)
+ return;
Being *const dstBeing = actorManager->findBeing(id);
if (dstBeing == nullptr)
return;
@@ -1736,6 +1743,8 @@ void BeingRecv::processBeingSelfEffect(Net::MessageIn &msg)
void BeingRecv::processMobInfo(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const int len = msg.readInt16("len");
if (len < 12)
return;
@@ -1748,6 +1757,8 @@ void BeingRecv::processMobInfo(Net::MessageIn &msg)
void BeingRecv::processBeingAttrs(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const int len = msg.readInt16("len");
if (len < 14)
return;
@@ -1803,6 +1814,8 @@ void BeingRecv::processClassChange(Net::MessageIn &msg)
void BeingRecv::processSpiritBalls(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
Being *const dstBeing = actorManager->findBeing(
msg.readBeingId("being id"));
const int balls = msg.readInt16("spirits amount");
@@ -1836,6 +1849,8 @@ void BeingRecv::processWddingEffect(Net::MessageIn &msg)
void BeingRecv::processBeingSlide(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
Being *const dstBeing = actorManager->findBeing(
msg.readBeingId("being id"));
const int x = msg.readInt16("x");
diff --git a/src/net/eathena/buyingstorerecv.cpp b/src/net/eathena/buyingstorerecv.cpp
index 0697b87f7..90766686a 100644
--- a/src/net/eathena/buyingstorerecv.cpp
+++ b/src/net/eathena/buyingstorerecv.cpp
@@ -93,6 +93,8 @@ void BuyingStoreRecv::processBuyingStoreOwnItems(Net::MessageIn &msg)
void BuyingStoreRecv::processBuyingStoreShowBoard(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const BeingId id = msg.readBeingId("owner id");
Being *const dstBeing = actorManager->findBeing(id);
if (dstBeing != nullptr)
@@ -107,6 +109,8 @@ void BuyingStoreRecv::processBuyingStoreShowBoard(Net::MessageIn &msg)
void BuyingStoreRecv::processBuyingStoreHideBoard(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const BeingId id = msg.readBeingId("owner id");
Being *const dstBeing = actorManager->findBeing(id);
if (dstBeing != nullptr)
@@ -120,6 +124,8 @@ void BuyingStoreRecv::processBuyingStoreHideBoard(Net::MessageIn &msg)
void BuyingStoreRecv::processBuyingStoreItemsList(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const int count = (msg.readInt16("len") - 16) / 9;
const BeingId id = msg.readBeingId("account id");
const int storeId = msg.readInt32("store id");
diff --git a/src/net/eathena/chatrecv.cpp b/src/net/eathena/chatrecv.cpp
index 8ffab1efb..eb6892545 100644
--- a/src/net/eathena/chatrecv.cpp
+++ b/src/net/eathena/chatrecv.cpp
@@ -365,6 +365,8 @@ void ChatRecv::processChatIgnoreList(Net::MessageIn &msg)
void ChatRecv::processChatDisplay(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const int len = msg.readInt16("len") - 17;
ChatObject *const obj = new ChatObject;
obj->ownerId = msg.readBeingId("owner account id");
@@ -415,6 +417,8 @@ void ChatRecv::processChatRoomJoinAck(Net::MessageIn &msg)
void ChatRecv::processChatRoomLeave(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
msg.readInt16("users");
const std::string name = msg.readString(24, "name");
const int status = msg.readUInt8("flag"); // 0 - left, 1 - kicked
@@ -608,6 +612,8 @@ void ChatRecv::processChatRoomCreateAck(Net::MessageIn &msg)
void ChatRecv::processChatRoomDestroy(Net::MessageIn &msg)
{
const int chatId = msg.readInt32("chat id");
+ if (actorManager == nullptr)
+ return;
actorManager->removeRoom(chatId);
}
@@ -672,8 +678,10 @@ void ChatRecv::processChatRoomSettings(Net::MessageIn &msg)
if (chat->title != title)
{
chat->title = title;
- actorManager->updateRoom(chat);
- chatWindow->joinRoom(true);
+ if (actorManager != nullptr)
+ actorManager->updateRoom(chat);
+ if (chatWindow != nullptr)
+ chatWindow->joinRoom(true);
}
}
}
diff --git a/src/net/eathena/clanhandler.h b/src/net/eathena/clanhandler.h
index f1ce56eb6..c0f62f380 100644
--- a/src/net/eathena/clanhandler.h
+++ b/src/net/eathena/clanhandler.h
@@ -25,7 +25,6 @@
namespace EAthena
{
-class MessageOut;
class ClanHandler final : public Net::ClanHandler
{
diff --git a/src/net/eathena/clanrecv.cpp b/src/net/eathena/clanrecv.cpp
index a46cf4f57..7324003b3 100644
--- a/src/net/eathena/clanrecv.cpp
+++ b/src/net/eathena/clanrecv.cpp
@@ -21,7 +21,6 @@
#include "net/eathena/clanrecv.h"
#include "configuration.h"
-#include "logger.h"
#include "being/localclan.h"
diff --git a/src/net/eathena/homunculusrecv.cpp b/src/net/eathena/homunculusrecv.cpp
index 476564d22..0f0d619ae 100644
--- a/src/net/eathena/homunculusrecv.cpp
+++ b/src/net/eathena/homunculusrecv.cpp
@@ -77,6 +77,8 @@ void HomunculusRecv::processHomunculusSkills(Net::MessageIn &msg)
void HomunculusRecv::processHomunculusData(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
msg.readUInt8("unused");
const int cmd = msg.readUInt8("state");
const BeingId id = msg.readBeingId("homunculus id");
@@ -111,6 +113,8 @@ void HomunculusRecv::processHomunculusData(Net::MessageIn &msg)
void HomunculusRecv::processHomunculusInfo(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const std::string name = msg.readString(24, "name");
msg.readUInt8("flags"); // 0x01 - renamed, 0x02 - vaporize, 0x04 - alive
const int level = msg.readInt16("level");
diff --git a/src/net/eathena/mercenaryrecv.cpp b/src/net/eathena/mercenaryrecv.cpp
index 7b1c80545..bd4579c83 100644
--- a/src/net/eathena/mercenaryrecv.cpp
+++ b/src/net/eathena/mercenaryrecv.cpp
@@ -78,6 +78,8 @@ void MercenaryRecv::processMercenaryUpdate(Net::MessageIn &msg)
void MercenaryRecv::processMercenaryInfo(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
// +++ need create if need mercenary being and update stats
Being *const dstBeing = actorManager->findBeing(
msg.readBeingId("being id"));
diff --git a/src/net/eathena/npcrecv.cpp b/src/net/eathena/npcrecv.cpp
index ec791f498..f926aff1a 100644
--- a/src/net/eathena/npcrecv.cpp
+++ b/src/net/eathena/npcrecv.cpp
@@ -100,6 +100,8 @@ void NpcRecv::processNpcCloseTimeout(Net::MessageIn &msg)
void NpcRecv::processArea(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const int len = msg.readInt16("len");
if (len < 12)
return;
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index 86b9f6b2e..542ebd4df 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -176,6 +176,8 @@ void PartyHandler::setShareItems(const PartyShareT share) const
void PartyHandler::changeLeader(const std::string &name) const
{
+ if (actorManager == nullptr)
+ return;
const Being *const being = actorManager->findBeingByName(
name, ActorType::Player);
if (being == nullptr)
diff --git a/src/net/eathena/petrecv.cpp b/src/net/eathena/petrecv.cpp
index 5fb07165c..6516186f1 100644
--- a/src/net/eathena/petrecv.cpp
+++ b/src/net/eathena/petrecv.cpp
@@ -99,6 +99,8 @@ void PetRecv::processEggsList(Net::MessageIn &msg)
void PetRecv::processPetData(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const int cmd = msg.readUInt8("type");
const BeingId id = msg.readBeingId("pet id");
Being *const dstBeing = actorManager->findBeing(id);
diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp
index 25f2972fc..d9f85f45b 100644
--- a/src/net/eathena/playerrecv.cpp
+++ b/src/net/eathena/playerrecv.cpp
@@ -495,6 +495,8 @@ void PlayerRecv::processDressRoomOpen(Net::MessageIn &msg)
void PlayerRecv::processKilledBy(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const BeingId id = msg.readBeingId("killer id");
const Being *const dstBeing = actorManager->findBeing(id);
if (id == BeingId_zero)
diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp
index 4839fa74e..2e8092886 100644
--- a/src/net/eathena/vendingrecv.cpp
+++ b/src/net/eathena/vendingrecv.cpp
@@ -74,6 +74,8 @@ void VendingRecv::processOpenReq(Net::MessageIn &msg)
void VendingRecv::processShowBoard(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const BeingId id = msg.readBeingId("owner id");
Being *const dstBeing = actorManager->findBeing(id);
if (dstBeing != nullptr)
@@ -88,6 +90,8 @@ void VendingRecv::processShowBoard(Net::MessageIn &msg)
void VendingRecv::processHideBoard(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
const BeingId id = msg.readBeingId("owner id");
Being *const dstBeing = actorManager->findBeing(id);
if (dstBeing != nullptr)
@@ -101,6 +105,8 @@ void VendingRecv::processHideBoard(Net::MessageIn &msg)
void VendingRecv::processItemsList(Net::MessageIn &msg)
{
+ if (actorManager == nullptr)
+ return;
int packetLen = 22;
if (msg.getVersion() >= 20160921)
packetLen = 53;