Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Core/GameEngine/Source/GameNetwork/NetCommandList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ NetCommandRef * NetCommandList::addMessage(NetCommandRef *&msg) {
NetCommandRef *theNext = m_lastMessageInserted->getNext();
if ((m_lastMessageInserted->getCommand()->getNetCommandType() == msg->getCommand()->getNetCommandType()) &&
(m_lastMessageInserted->getCommand()->getPlayerID() == msg->getCommand()->getPlayerID()) &&
isCommandIdNewer(msg->getCommand()->getID(), m_lastMessageInserted->getCommand()->getID()) &&
isCommandIdNewer(msg->getCommand()->getSortNumber(), m_lastMessageInserted->getCommand()->getSortNumber()) &&
((theNext == nullptr) || ((theNext->getCommand()->getNetCommandType() > msg->getCommand()->getNetCommandType()) ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If theNext == nullptr than this if-statement may fire and call theNext->getCommand()->getSortNumber() which will fire an exception.

Apart from the horrible readability, I think there are more issues with this if statement. Might want to fix that all in this PR.

(theNext->getCommand()->getPlayerID() > msg->getCommand()->getPlayerID()) ||
isCommandIdNewer(theNext->getCommand()->getID(), msg->getCommand()->getID())))) {
isCommandIdNewer(theNext->getCommand()->getSortNumber(), msg->getCommand()->getSortNumber())))) {

// Make sure this command isn't already in the list.
if (isEqualCommandMsg(m_lastMessageInserted->getCommand(), msg->getCommand())) {
Expand Down
Loading