From afdfd4fbf0d60705830c5ec6d4720eeec4d20279 Mon Sep 17 00:00:00 2001 From: Alain BKR <31039036+alain-bkr@users.noreply.github.com> Date: Sat, 6 May 2023 17:14:22 +0200 Subject: [PATCH] tiny fix : common/nation.c:562:21: applying zero offset to null pointer --- common/nation.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/nation.c b/common/nation.c index 48b7aa087..00325bf19 100644 --- a/common/nation.c +++ b/common/nation.c @@ -559,7 +559,11 @@ struct iterator *nation_iter_init(struct nation_iter *it) it->vtable.get = nation_iter_get; it->vtable.valid = nation_iter_valid; it->p = nations; - it->end = nations + nation_count(); + if (nations == NULL) { + it->end = NULL; + } else { + it->end = nations + nation_count(); + } return ITERATOR(it); } -- 2.34.1