Browse Source

Merge pull request #5097 from laytan/fix-pointer-alias-type-check

fixes assigning null as a type if it's an alias but the base type is null
Laytan 3 months ago
parent
commit
c74f777b1b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/check_expr.cpp

+ 4 - 1
src/check_expr.cpp

@@ -1854,7 +1854,10 @@ gb_internal Entity *check_ident(CheckerContext *c, Operand *o, Ast *n, Type *nam
 			o->type = t_invalid;
 		}
 		if (o->type != nullptr && o->type->kind == Type_Named && o->type->Named.type_name->TypeName.is_type_alias) {
-			o->type = base_type(o->type);
+			Type *bt = base_type(o->type);
+			if (bt != nullptr) {
+				o->type = bt;
+			}
 		}
 
 		break;