diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-07-17 18:55:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-07-17 18:55:36 +0300 |
commit | 4ecdb004e81a459ea63ebd7127e1c945df43f9ce (patch) | |
tree | a8ece58a62724c4b088484e0b5c1f44fdbf2f7e1 /src/net | |
parent | 334c1c50dfa57da0b91687e097db295a6a3b699b (diff) | |
download | mv-4ecdb004e81a459ea63ebd7127e1c945df43f9ce.tar.gz mv-4ecdb004e81a459ea63ebd7127e1c945df43f9ce.tar.bz2 mv-4ecdb004e81a459ea63ebd7127e1c945df43f9ce.tar.xz mv-4ecdb004e81a459ea63ebd7127e1c945df43f9ce.zip |
Fix issues detected by coverity.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 4 | ||||
-rw-r--r-- | src/net/net.cpp | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 435468fb6..c7c0c801c 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -703,7 +703,9 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) // because server don't send direction in move packet, we fixing it uint8_t d = 0; - if (srcX == dstX && srcY == dstY) + if (localPlayer != nullptr && + srcX == dstX && + srcY == dstY) { // if player did one step from invisible area to visible, // move path is broken int x2 = localPlayer->getTileX(); diff --git a/src/net/net.cpp b/src/net/net.cpp index d6b6e2945..7f394bcc4 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -113,14 +113,18 @@ std::set<int> ignorePackets; void connectToServer(const ServerInfo &server) { BLOCK_START("Net::connectToServer") - if (networkType == server.type && (generalHandler != nullptr)) + if (networkType == server.type && + generalHandler != nullptr) { generalHandler->reload(); } else { - if (networkType != ServerType::UNKNOWN && (generalHandler != nullptr)) + if (networkType != ServerType::UNKNOWN && + generalHandler != nullptr) + { generalHandler->unload(); + } switch (server.type) { @@ -141,7 +145,8 @@ void connectToServer(const ServerInfo &server) break; } - generalHandler->load(); + if (generalHandler != nullptr) + generalHandler->load(); networkType = server.type; } |