Skip to contentSkip to conversation

Check for NULL stmt in check_all_func_returns

PATCH In review [email protected] 2 participants 2 messages May 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Check for NULL stmt in check_all_func_returns

From: John Levon <[email protected]>

Sometimes, there's nothing on the statement stack.

---
 check_all_func_returns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
check_all_func_returns.c +1 -1
index f9d77449..1ff50433 100644
@@ -74,7 +74,7 @@ static void check_func_return(struct expression *expr)
 
 	stmt = last_ptr_list((struct ptr_list *)big_statement_stack);
 
-	if (stmt->type == STMT_EXPRESSION && stmt->expression == expr)
+	if (stmt && stmt->type == STMT_EXPRESSION && stmt->expression == expr)
 		sm_error("unchecked function return '%s'", expr_to_str(expr->fn));
 }
 
Signature · 1 line
2.23.0