aboutsummaryrefslogtreecommitdiff
path: root/clectio.c
diff options
context:
space:
mode:
Diffstat (limited to 'clectio.c')
-rw-r--r--clectio.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/clectio.c b/clectio.c
index 0032557..d16fb72 100644
--- a/clectio.c
+++ b/clectio.c
@@ -32,6 +32,7 @@
static char *textbuf; /* inflated verse text */
static const char **verse; /* verse[i] -> the text of the i-th key, nul-terminated */
+static size_t nverse; /* how many the packed text actually holds */
static int usecolor;
static const char *const colname[] = { "green", "white", "red", "violet", "rose", "black" };
@@ -80,6 +81,7 @@ static void load_text(void) {
verse[n++] = p + 1;
}
}
+ nverse = n;
}
static const char *citation(int r) {
@@ -237,8 +239,21 @@ static void print_day(long off, const char *datestr, int mon, int day, int gospe
if (gospel && strcmp(parts[r->part], "Gospel") != 0)
continue;
printf("\n%s (%s)\n\n", parts[r->part], citation(rpool[d->roff + ri]));
- for (v = 0; v < r->vlen; v++)
+ for (v = 0; v < r->vlen; v++) {
+ /* gen/liturgy_<form>.h and the packed text are generated
+ * together but shipped apart, and the Makefile unpacks the
+ * verse keys from the COMMITTED gen/verses_<form>.keys.gz --
+ * so regenerating the tables without also refreshing that
+ * .gz leaves the tables indexing verses the text does not
+ * hold. That shipped once: 1246 of the 10957 EF dates
+ * segfaulted here on a NULL verse. Missing text is now a
+ * visible gap, never a crash. */
+ if (vpool[r->voff + v] >= nverse) {
+ fputs(" [verse text missing]\n", stdout);
+ continue;
+ }
putwrapped(verse[vpool[r->voff + v]], wrap);
+ }
}
}