aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--midend.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/midend.c b/midend.c
index 27c015b..6c1a599 100644
--- a/midend.c
+++ b/midend.c
@@ -2418,7 +2418,12 @@ static const char *midend_deserialise_internal(
ret = "No state count provided in save file";
goto cleanup;
}
+ if (data.statepos < 0) {
+ ret = "No game position provided in save file";
+ goto cleanup;
+ }
gotstates++;
+ assert(gotstates < data.nstates);
if (!strcmp(key, "MOVE"))
data.states[gotstates].movetype = MOVE;
else if (!strcmp(key, "SOLVE"))