From f0dc51d544f5727ad813cbc30385837a92ad8d73 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Jul 2025 14:25:31 -0400 Subject: [PATCH] fix: a bug where checking the whether a type is referenced would lead to a null reference exception Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs b/src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs index 93ffc7e0..9c037889 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs @@ -238,7 +238,8 @@ internal static bool IsBaseTypeReferencedAsTypeInModel( if (isReferencedInAction) return true; // Recursively check the base type - return model.IsBaseTypeReferencedAsTypeInModel(baseType.BaseType, structuredTypes, actions); + if (baseType.BaseType is not null) + return model.IsBaseTypeReferencedAsTypeInModel(baseType.BaseType, structuredTypes, actions); } return false;