Skip to content

Commit 39bbbc2

Browse files
authored
Merge pull request #713 from microsoft/fix/NRE-on-base-type
fix: a bug where checking the whether a type is referenced would lead to a null reference exception
2 parents d6582f5 + f0dc51d commit 39bbbc2

File tree

1 file changed

+2
-1
lines changed
  • src/Microsoft.OpenApi.OData.Reader/Common

1 file changed

+2
-1
lines changed

src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ internal static bool IsBaseTypeReferencedAsTypeInModel(
238238
if (isReferencedInAction) return true;
239239

240240
// Recursively check the base type
241-
return model.IsBaseTypeReferencedAsTypeInModel(baseType.BaseType, structuredTypes, actions);
241+
if (baseType.BaseType is not null)
242+
return model.IsBaseTypeReferencedAsTypeInModel(baseType.BaseType, structuredTypes, actions);
242243
}
243244

244245
return false;

0 commit comments

Comments
 (0)