From 997d1ffd4b9dbcf3c3a671a33d4e7c10e640838d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 31 Oct 2014 15:52:40 +0100 Subject: [PATCH] Fix some crashes that happened while debugging an old data file. --- src/kernel/save.c | 7 ++++--- src/reports.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/kernel/save.c b/src/kernel/save.c index 77a33b50f..f6fb4c540 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1119,6 +1119,10 @@ static ally **addally(const faction * f, ally ** sfp, int aid, int state) if (state == 0) return sfp; + while (*sfp) { + sfp = &(*sfp)->next; + } + sf = ally_add(sfp, af); if (!sf->faction) { variant id; @@ -1127,9 +1131,6 @@ static ally **addally(const faction * f, ally ** sfp, int aid, int state) } sf->status = state & HELP_ALL; - while (*sfp) - sfp = &(*sfp)->next; - *sfp = sf; return &sf->next; } diff --git a/src/reports.c b/src/reports.c index 1939fa972..e7ca9c314 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1183,7 +1183,7 @@ link_seen(seen_region * seehash[], const region * first, const region * last) } r = r->next; } - sr->next = 0; + if (sr) sr->next = 0; } seen_region *find_seen(struct seen_region *seehash[], const region * r)