diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-09-11 11:57:24 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-09-11 11:57:24 +0000 |
| commit | 08c8cf370ef7575a78988eb7d8f98c2a0bb92c63 (patch) | |
| tree | cf493cebbe51b1bef224e818bf00111d14673a4f | |
| parent | efda6cff49e7579b5c10b16694ac57340ce2fc2b (diff) | |
| download | puzzles-08c8cf370ef7575a78988eb7d8f98c2a0bb92c63.zip puzzles-08c8cf370ef7575a78988eb7d8f98c2a0bb92c63.tar.gz puzzles-08c8cf370ef7575a78988eb7d8f98c2a0bb92c63.tar.bz2 puzzles-08c8cf370ef7575a78988eb7d8f98c2a0bb92c63.tar.xz | |
Marginally greater robustness in the face of solve_game() failing to
return an error message.
[originally from svn r6288]
| -rw-r--r-- | midend.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); |