Marginally greater robustness in the face of solve_game() failing to

return an error message.

[originally from svn r6288]
This commit is contained in:
Simon Tatham
2005-09-11 11:57:24 +00:00
parent efda6cff49
commit 08c8cf370e

View File

@ -1167,12 +1167,15 @@ char *midend_solve(midend *me)
if (me->statepos < 1)
return "No game set up to solve"; /* _shouldn't_ happen! */
msg = "Solve operation failed"; /* game _should_ overwrite on error */
msg = NULL;
movestr = me->ourgame->solve(me->states[0].state,
me->states[me->statepos-1].state,
me->aux_info, &msg);
if (!movestr)
if (!movestr) {
if (!msg)
msg = "Solve operation failed"; /* _shouldn't_ happen, but can */
return msg;
}
s = me->ourgame->execute_move(me->states[me->statepos-1].state, movestr);
assert(s);