diff --git a/magnets.c b/magnets.c index d190848..d95d146 100644 --- a/magnets.c +++ b/magnets.c @@ -520,7 +520,7 @@ nextchar: * (i.e. each end points to the other) */ for (idx = 0; idx < state->wh; idx++) { if (state->common->dominoes[idx] < 0 || - state->common->dominoes[idx] > state->wh || + state->common->dominoes[idx] >= state->wh || state->common->dominoes[state->common->dominoes[idx]] != idx) { *prob = "Domino descriptions inconsistent"; goto done;