From: Wolfgang (Blub) Bumiller Date: Sun, 25 Nov 2012 22:51:39 +0000 (+0100) Subject: ast_breakcont_codegen: error when a target is missing instead of segfaulting trying... X-Git-Tag: 0.1.9~211 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=bf244fc9602bb93bf47027830ec2162b8dd4afe8 ast_breakcont_codegen: error when a target is missing instead of segfaulting trying to access it anyway --- diff --git a/ast.c b/ast.c index bd67638..6f90b18 100644 --- a/ast.c +++ b/ast.c @@ -2531,6 +2531,11 @@ bool ast_breakcont_codegen(ast_breakcont *self, ast_function *func, bool lvalue, else target = func->breakblock; + if (!target) { + asterror(ast_ctx(self), "%s is lacking a target block", (self->is_continue ? "continue" : "break")); + return false; + } + if (!ir_block_create_jump(func->curblock, target)) return false; return true;