-
Notifications
You must be signed in to change notification settings - Fork 256
bugfix(replay): Stop dereferencing a null slot when a replay has no local player #3240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
50b3329
c1bc7ac
598b1c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1315,7 +1315,11 @@ void GameLogic::tryStartNewGame( Bool loadingSaveGame ) | |
| d.setInt(TheKey_multiplayerStartIndex, slot->getStartPos()); | ||
| // d.setBool(TheKey_multiplayerIsLocal, slot->isLocalPlayer()); | ||
| // d.setBool(TheKey_multiplayerIsLocal, slot->getIP() == game->getLocalIP()); | ||
| d.setBool(TheKey_multiplayerIsLocal, slot->isHuman() && (slot->getName().compare(TheGameInfo->getSlot(TheGameInfo->getLocalSlotNum())->getName().str()) == 0)); | ||
| // TheSuperHackers @bugfix bobtista 30/08/2026 A replay recorded without a local player has no | ||
| // local slot number and getSlot returns NULL for it, so no slot can be the local one. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is too verbose. |
||
| const Int localSlotNum = TheGameInfo->getLocalSlotNum(); | ||
| const GameSlot *localGameSlot = localSlotNum >= 0 ? TheGameInfo->getSlot(localSlotNum) : nullptr; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| d.setBool(TheKey_multiplayerIsLocal, slot->isHuman() && localGameSlot != nullptr && (slot->getName().compare(localGameSlot->getName().str()) == 0)); | ||
|
Comment on lines
+1320
to
+1322
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. No-player replays inherit old viewpoints tryStartNewGame trusts getLocalSlotNum() even though replay loading does not clear or replace m_localIP when the recorded index is -1. After an earlier replay leaves a matching IP behind, the affected replay marks that human as local and uses their starting position and player state instead of taking the deterministic no-local fallback. Agent Prompt
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is very long. Can be broken into 2. |
||
|
|
||
| /* | ||
| if (slot->getIP() == game->getLocalIP()) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment tells what the code did before, which no one cares for. It is also too verbose.