diff --git a/releasenotes.md b/releasenotes.md index 51efb089e..cf7bba4a4 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -41,6 +41,7 @@ - Incorrect "no-libc" definition of `cos`, making it unavailable for wasm. - Fix issue with the adjoint and inverse calculations for `Matrix2x2`. - It was possible to create 0 length arrays using byte literals. #1678 +- Crash when a constant null typeid is checked for properties. #1679 ### Stdlib changes - Add `io::MultiReader`, `io::MultiWriter`, and `io::TeeReader` structs. diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index e2a67cb21..482d46190 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -4289,6 +4289,7 @@ static bool sema_expr_rewrite_to_typeid_property(SemaContext *context, Expr *exp if (sema_cast_const(typeid)) { Type *type = typeid->const_expr.typeid; + if (type == NULL) return false; if (!sema_type_property_is_valid_for_type(type, property)) return false; *was_error = !sema_expr_rewrite_to_type_property(context, expr, type, property, type); return true;