瀏覽代碼

Fix bug in `check_is_terminating`

gingerBill 4 年之前
父節點
當前提交
fe2ad54f60
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/check_stmt.cpp

+ 3 - 0
src/check_stmt.cpp

@@ -263,6 +263,9 @@ bool check_is_terminating(Ast *node, String const &label) {
 			if (tv.value.value_bool) {
 				return check_is_terminating(ws->body, label);
 			} else {
+				if (ws->else_stmt == nullptr) {
+					return false;
+				}
 				return check_is_terminating(ws->else_stmt, label);
 			}
 		}