aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-08-13 22:51:04 +0100
committergingerBill <bill@gingerbill.org>2019-08-13 22:51:04 +0100
commitb86dfa7af79a1563b2f47622aeeaedb737eaafb8 (patch)
tree03850a8e86dbc1433cd5f7d84d2bf726fc55d43c /src
parent980890ee8a5fdfd1dc0ae6412fcf004eb250bb08 (diff)
Fix compiler crash with #defined #417
Diffstat (limited to 'src')
-rw-r--r--src/check_expr.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 7a6e0f22d..8da6816ac 100644
--- a/src/check_expr.cpp
+++ b/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;
}