diff options
| author | gingerBill <bill@gingerbill.org> | 2022-11-01 14:45:51 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-11-01 14:45:51 +0000 |
| commit | c18e98e8c5659610127a24d33cacab2770668b1c (patch) | |
| tree | bfc879ed86e4d04442d7f359aa627e1247191081 /src/checker.cpp | |
| parent | 2b7ca2bdd6be41abeb8ab5c5fa91f24657996e88 (diff) | |
Add extra check in `add_entity_and_decl_info` #2161
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 9b2f72205..dd81e2a48 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -1673,7 +1673,11 @@ bool could_entity_be_lazy(Entity *e, DeclInfo *d) { } void add_entity_and_decl_info(CheckerContext *c, Ast *identifier, Entity *e, DeclInfo *d, bool is_exported) { - GB_ASSERT(identifier != nullptr); + if (identifier == nullptr) { + // NOTE(bill): Should only happen on errors + error(e->token, "Invalid variable declaration"); + return; + } if (identifier->kind != Ast_Ident) { // NOTE(bill): This is a safety check gbString s = expr_to_string(identifier); |