Browse Source

Fix compiler crash with #defined #417

gingerBill 6 years ago
parent
commit
b86dfa7af7
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/check_expr.cpp

+ 2 - 2
src/check_expr.cpp

@@ -3368,8 +3368,8 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
 				return false;
 			}
 			Ast *arg = unparen_expr(ce->args[0]);
-			if (arg->kind != Ast_Ident && arg->kind != Ast_SelectorExpr) {
-				error(call, "'#defined' expects an identifier or selector expression, got %s", LIT(ast_strings[arg->kind]));
+			if (arg == nullptr || (arg->kind != Ast_Ident && arg->kind != Ast_SelectorExpr)) {
+				error(call, "'#defined' expects an identifier or selector expression, got %.*s", LIT(ast_strings[arg->kind]));
 				return false;
 			}