From bf244fc9602bb93bf47027830ec2162b8dd4afe8 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sun, 25 Nov 2012 23:51:39 +0100 Subject: [PATCH] ast_breakcont_codegen: error when a target is missing instead of segfaulting trying to access it anyway --- ast.c | 5 +++++ 1 file changed, 5 insertions(+) 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;