]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.c
ast_breakcont_codegen: error when a target is missing instead of segfaulting trying...
[xonotic/gmqcc.git] / ast.c
diff --git a/ast.c b/ast.c
index bd67638f1f2b0625bc95d7739225cb796b6b6ae5..6f90b1841262b60376626350ab3e95ab1fb9b08a 100644 (file)
--- 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;