[gamecode] Check for nil entity

Fixes a segfault when disassembling progs.dat files that access entity
fields as the accessed entity will generally be nil.
This commit is contained in:
Bill Currie 2021-06-27 14:47:08 +09:00
parent 139a6aee87
commit d865095d0b

View file

@ -1600,7 +1600,7 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
opval = pr->pr_globals[s->a].entity_var;
parm_ind = pr->pr_globals[s->b].uinteger_var;
if (parm_ind < pr->progs->entityfields
&& opval >= 0
&& opval > 0
&& opval < pr->pr_edict_area_size) {
ed = PROG_TO_EDICT (pr, opval);
opval = &E_fld(ed, parm_ind) - pr->pr_globals;