Range: Don't fail an assertion on an all-black board

If there are no white squares, then Range's check that all the white
squares form a connected component goes wrong.  Skip the check in that
case to avoid an assretion violation ("edsf_canonify: Assertion `index
>= 0' failed.").  This can be demonstrated by starting a game with no
clues (e.g. "range 3:i") and then filling in every square.
This commit is contained in:
Ben Harris
2023-02-04 16:50:55 +00:00
parent 84ec2a0a77
commit ae73ad76ef

View File

@ -1494,7 +1494,8 @@ static bool find_errors(const game_state *state, bool *report)
if (state->grid[r*w+c] != BLACK && if (state->grid[r*w+c] != BLACK &&
state->grid[r*w+(c+1)] != BLACK) state->grid[r*w+(c+1)] != BLACK)
dsf_merge(dsf, r*w+c, r*w+(c+1)); dsf_merge(dsf, r*w+c, r*w+(c+1));
if (nblack + dsf_size(dsf, any_white_cell) < n) { if (any_white_cell != -1 &&
nblack + dsf_size(dsf, any_white_cell) < n) {
int biggest, canonical; int biggest, canonical;
if (!report) { if (!report) {