From 38811472107195d58b44db6453e4988ac272bba5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 18 Jan 2025 15:23:37 +0900 Subject: [PATCH] [qfcc] Check return value for null in has_function_call Avoids a segfault when dagging. I'm not sure how a switch statement got into the dags, but still don't want a segfault there. --- tools/qfcc/source/expr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index cac6c51c1..b1267acdc 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -1943,6 +1943,10 @@ has_function_call (const expr_t *e) // in is just a cast of out, if it's not null return has_function_call (e->inout.out); case ex_return: + if (!e->retrn.ret_val) { + // if there's no return value, can't possibly have a call + return false; + } return has_function_call (e->retrn.ret_val); case ex_horizontal: return has_function_call (e->hop.vec);