From 3edd3e58695dd157ad08c0e2b7a64393b135089f Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 28 Feb 2024 16:15:30 -0500 Subject: [PATCH] catch invalid id on restore Another EDITLEVEL bump. --- include/patchlevel.h | 2 +- src/light.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/patchlevel.h b/include/patchlevel.h index 74f586c56..130ae8beb 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -17,7 +17,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 99 +#define EDITLEVEL 100 /* * Development status possibilities. diff --git a/src/light.c b/src/light.c index 85c2beb2c..13708f8c7 100644 --- a/src/light.c +++ b/src/light.c @@ -473,6 +473,14 @@ relink_light_sources(boolean ghostly) for (ls = gl.light_base; ls; ls = ls->next) { if (ls->flags & LSF_NEEDS_FIXUP) { if (ls->type == LS_OBJECT || ls->type == LS_MONSTER) { + if (!ls->id.a_uint) { + /* it was possible to get stuck in this loop on bad + * savefile data load and repeatedly prompt the player + * for a key press after displaying an impossible message. + * Consider this bad data from a savefile and panic() */ + panic("relink_light_sources: id = 0, type = %d", + (int) ls->type); + } if (ghostly) { if (!lookup_id_mapping(ls->id.a_uint, &nid)) impossible("relink_light_sources: no id mapping");