mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Galaxies: fix assertion failure when adding out-of-bounds association.
Adding an association with an out-of-bounds square (i.e. by pressing Return with a dot selected, and then moving the cursor so the `opposite' arrow was off the screen) would cause space_opposite_dot() to return NULL, in turn causing ok_to_add_assoc_with_opposite_internal() to return false, failing the assertion. This assertion appears to have been introduced in 68363231.
This commit is contained in:

committed by
Simon Tatham

parent
78bc9ea7f7
commit
84cb4c6701
@ -382,6 +382,8 @@ static bool ok_to_add_assoc_with_opposite(
|
||||
static void add_assoc_with_opposite(game_state *state, space *tile, space *dot) {
|
||||
space *opposite = space_opposite_dot(state, tile, dot);
|
||||
|
||||
if(opposite)
|
||||
{
|
||||
assert(ok_to_add_assoc_with_opposite_internal(state, tile, opposite));
|
||||
|
||||
remove_assoc_with_opposite(state, tile);
|
||||
@ -389,6 +391,7 @@ static void add_assoc_with_opposite(game_state *state, space *tile, space *dot)
|
||||
remove_assoc_with_opposite(state, opposite);
|
||||
add_assoc(state, opposite, dot);
|
||||
}
|
||||
}
|
||||
|
||||
static space *sp2dot(const game_state *state, int x, int y)
|
||||
{
|
||||
|
Reference in New Issue
Block a user