From b18af37c578b118a245c911508d73ed23c303ee0 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 7 Sep 2018 15:17:24 -0400 Subject: fix crash when var init has compile error and then the var is referenced closes #1483 --- src/ir.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index 0269c29b1a..30f40b3a1e 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -13107,8 +13107,7 @@ static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, assert(ira->codegen->errors.length != 0); return ira->codegen->invalid_instruction; } - assert(var->value->type); - if (type_is_invalid(var->value->type)) + if (var->value->type == nullptr || type_is_invalid(var->value->type)) return ira->codegen->invalid_instruction; bool comptime_var_mem = ir_get_var_is_comptime(var); -- cgit v1.2.3