aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--galaxies.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/galaxies.c b/galaxies.c
index 2761ed2..9172b90 100644
--- a/galaxies.c
+++ b/galaxies.c
@@ -382,12 +382,15 @@ 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);
- assert(ok_to_add_assoc_with_opposite_internal(state, tile, opposite));
+ if(opposite)
+ {
+ assert(ok_to_add_assoc_with_opposite_internal(state, tile, opposite));
- remove_assoc_with_opposite(state, tile);
- add_assoc(state, tile, dot);
- remove_assoc_with_opposite(state, opposite);
- add_assoc(state, opposite, dot);
+ remove_assoc_with_opposite(state, tile);
+ add_assoc(state, tile, dot);
+ remove_assoc_with_opposite(state, opposite);
+ add_assoc(state, opposite, dot);
+ }
}
static space *sp2dot(const game_state *state, int x, int y)