Skip to content

Commit 2db80c0

Browse files
committed
Fixes an invalid pointer access in GameTreeRep::Reveal.
Fixes #749.
1 parent 47e86f3 commit 2db80c0

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [16.5.1] - unreleased
4+
5+
### Fixed
6+
- `Game.reveal` raised a null pointer access exception or dumped core in some cases (#749)
7+
8+
39
## [16.5.0] - 2026-01-05
410

511
### Fixed

src/games/gametree.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,14 @@ void GameTreeRep::RemoveMember(GameInfosetRep *p_infoset, GameNodeRep *p_node)
259259
void GameTreeRep::Reveal(GameInfoset p_atInfoset, GamePlayer p_player)
260260
{
261261
IncrementVersion();
262-
for (auto action : p_atInfoset->GetActions()) {
263-
for (auto infoset : p_player->m_infosets) {
264-
// make copy of members to iterate correctly
265-
// (since the information set may be changed in the process)
262+
for (const auto &action : p_atInfoset->m_actions) {
263+
auto infosets = p_player->m_infosets;
264+
for (const auto &infoset : infosets) {
266265
auto members = infoset->m_members;
267-
268266
// This information set holds all members of information set
269267
// which follow 'action'.
270268
GameInfoset newiset = nullptr;
271-
for (auto &member : members) {
269+
for (const auto &member : members) {
272270
if (action->Precedes(member)) {
273271
if (!newiset) {
274272
newiset = LeaveInfoset(member);

0 commit comments

Comments
 (0)