From 253d19876cc50adba42a1790f0dd837cabae76b1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 24 Aug 2003 05:08:47 +0000 Subject: [PATCH] no code to dump for a null function --- libs/gamecode/engine/pr_debug.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/libs/gamecode/engine/pr_debug.c b/libs/gamecode/engine/pr_debug.c index a0671e75a..9eeeaaa49 100644 --- a/libs/gamecode/engine/pr_debug.c +++ b/libs/gamecode/engine/pr_debug.c @@ -407,23 +407,25 @@ PR_Get_Local_Def (progs_t *pr, int offs) void PR_DumpState (progs_t *pr) { - if (pr_debug->int_val && pr->debug) { - pr_lineno_t *lineno; - pr_auxfunction_t *func = 0; - int addr = pr->pr_xstatement; + if (pr->pr_xfunction) { + if (pr_debug->int_val && pr->debug) { + pr_lineno_t *lineno; + pr_auxfunction_t *func = 0; + int addr = pr->pr_xstatement; - lineno = PR_Find_Lineno (pr, addr); - if (lineno) - func = PR_Get_Lineno_Func (pr, lineno); - if (func && pr->pr_xfunction == pr->pr_functions + func->function) - addr =PR_Get_Lineno_Addr (pr, lineno); - else - addr = max (pr->pr_xfunction->first_statement, addr - 5); + lineno = PR_Find_Lineno (pr, addr); + if (lineno) + func = PR_Get_Lineno_Func (pr, lineno); + if (func && pr->pr_xfunction == pr->pr_functions + func->function) + addr = PR_Get_Lineno_Addr (pr, lineno); + else + addr = max (pr->pr_xfunction->first_statement, addr - 5); - while (addr != pr->pr_xstatement) - PR_PrintStatement (pr, pr->pr_statements + addr++); + while (addr != pr->pr_xstatement) + PR_PrintStatement (pr, pr->pr_statements + addr++); + } + PR_PrintStatement (pr, pr->pr_statements + pr->pr_xstatement); } - PR_PrintStatement (pr, pr->pr_statements + pr->pr_xstatement); PR_StackTrace (pr); }