From 86cf7fbecdff0be2d21824f14b9e250552bfd308 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 24 Jul 2021 18:04:57 +0900 Subject: [PATCH] [gamecode] Check for null edict before printing number Avoids segfault during double-verbose disassembly of progs code that uses entities. --- libs/gamecode/pr_debug.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/gamecode/pr_debug.c b/libs/gamecode/pr_debug.c index 7fc3ba455..6a73f762d 100644 --- a/libs/gamecode/pr_debug.c +++ b/libs/gamecode/pr_debug.c @@ -1237,10 +1237,12 @@ pr_debug_entity_view (qfot_type_t *type, pr_type_t *value, void *_data) if (pr->pr_edicts) { edict_t *edict = PROG_TO_EDICT (pr, value->entity_var); - dasprintf (dstr, "entity %d", NUM_FOR_BAD_EDICT (pr, edict)); - } else { - dasprintf (dstr, "entity [%x]",value->entity_var); + if (edict) { + dasprintf (dstr, "entity %d", NUM_FOR_BAD_EDICT (pr, edict)); + return; + } } + dasprintf (dstr, "entity [%x]", value->entity_var); } static void