aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2024-08-05 16:57:58 +0100
committerGitHub <noreply@github.com>2024-08-05 16:57:58 +0100
commit7c3461b0df6020ab20017d0eaca990a60fc9e8b1 (patch)
tree2eacc54f83747c496e1d50d889910caef4a3b7fc /src/check_expr.cpp
parent2cc37956866df444b0f32c44ee8b11c3dde6fc3b (diff)
parent6175efde3d4b2ec2cdac172cce0f2d1887705af2 (diff)
Merge pull request #4028 from Kelimion/fix-4026
Fix crash if referencing import "aliased" in other file.
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index b291cbe70..4bce42129 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -5158,6 +5158,14 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod
Scope *import_scope = e->ImportName.scope;
String entity_name = selector->Ident.token.string;
+ if (import_scope == nullptr) {
+ ERROR_BLOCK();
+ error(node, "'%.*s' is not imported in this file, '%.*s' is unavailable", LIT(import_name), LIT(entity_name));
+ operand->mode = Addressing_Invalid;
+ operand->expr = node;
+ return nullptr;
+ }
+
check_op_expr = false;
entity = scope_lookup_current(import_scope, entity_name);
bool allow_builtin = false;