From e2562298cb7043604d85ec84ea1863ce62285703 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 23 Jan 2025 19:34:32 +0100 Subject: [PATCH] null pointe exception in allies-related code (E3) --- src/reports.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/reports.c b/src/reports.c index 93d4dd496..27742f34f 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1162,11 +1162,13 @@ void get_addresses(report_context * ctx) while (u != NULL) { if (u->faction != ctx->f) { faction *sf = visible_faction(ctx->f, u, get_otherfaction(u)); - bool ballied = sf && sf != ctx->f && sf != lastf - && !fval(u, UFL_ANON_FACTION) && cansee(ctx->f, r, u, stealthmod); - if (ballied || is_allied(ctx->f, sf)) { - add_seen_faction_i(&flist, sf); - lastf = sf; + if (sf) { + bool ballied = sf != ctx->f && sf != lastf + && !fval(u, UFL_ANON_FACTION) && cansee(ctx->f, r, u, stealthmod); + if (ballied || is_allied(ctx->f, sf)) { + add_seen_faction_i(&flist, sf); + lastf = sf; + } } } u = u->next;