Skip to content

Commit

Permalink
Fix Protocol::getIP nullptr message (rework function logic) (opentibi…
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas authored Aug 5, 2022
1 parent 5f70e55 commit 0185869
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/server/network/protocol/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,11 @@ bool Protocol::RSA_decrypt(NetworkMessage& msg)

uint32_t Protocol::getIP() const
{
auto protocolConnection = getConnection();
if (protocolConnection == nullptr) {
SPDLOG_ERROR("[Protocol::getIP] - Connection is nullptr");
return 0;
if (auto protocolConnection = getConnection()) {
return protocolConnection->getIP();
}

return protocolConnection->getIP();
return 0;
}

void Protocol::enableCompression()
Expand Down

0 comments on commit 0185869

Please sign in to comment.