[gamecode] Check for null edict before printing number

Avoids segfault during double-verbose disassembly of progs code that
uses entities.
This commit is contained in:
Bill Currie 2021-07-24 18:04:57 +09:00
parent 7868936b96
commit 86cf7fbecd
1 changed files with 5 additions and 3 deletions

View File

@ -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