From a746ecd0b6422ef5454ceba801fae1f73bdf0203 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 27 Jun 2022 21:43:29 +0200 Subject: human_player_gui.c: fix segfault when selecting one unit Checking against `sel` is just plain wrong, since it always expected to be non-NULL, since `h->sel` is an array defined in `struct human_player`. Instead, `sel->d.i` is the pointer that should be checked. --- src/player/src/human_player_gui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/player/src/human_player_gui.c b/src/player/src/human_player_gui.c index b5caeea..ea39bca 100644 --- a/src/player/src/human_player_gui.c +++ b/src/player/src/human_player_gui.c @@ -206,7 +206,7 @@ static int render_sel_single(const struct human_player *const h, { const struct sel_instance *const sel = &h->sel[i]; - if (sel) + if (sel->d.i) { switch (sel->type) { -- cgit v1.2.3