aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.c b/main.c
index 7670a08..7298d56 100644
--- a/main.c
+++ b/main.c
@@ -841,7 +841,9 @@ void gen_if_stmt(CODEGEN* g, AST* ast) {
gen_stmt(g, ast->node1);
printf(" jmp .Lend%d\n", label);
printf(".Lelse%d:\n", label);
- gen_stmt(g, ast->node2);
+ if (ast->node2) {
+ gen_stmt(g, ast->node2);
+ }
printf(".Lend%d:\n", label);
}