From e9242d65295f2e9d18ab324d0776c85e75321ab6 Mon Sep 17 00:00:00 2001 From: Chris Martinez Date: Tue, 27 Dec 2022 16:28:35 -0800 Subject: [PATCH] Fix uncaught code analysis warnings causing a build break --- .../ApiExplorer/ODataApiExplorer.cs | 2 +- .../Conventions/ImplicitModelBoundSettingsConvention.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/ApiExplorer/ODataApiExplorer.cs b/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/ApiExplorer/ODataApiExplorer.cs index 4c45eb70..ddcdfe3e 100644 --- a/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/ApiExplorer/ODataApiExplorer.cs +++ b/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/ApiExplorer/ODataApiExplorer.cs @@ -54,7 +54,7 @@ public ODataApiExplorer( HttpConfiguration configuration ) public ODataApiExplorer( HttpConfiguration configuration, ODataApiExplorerOptions options ) : base( configuration, options ) { - this.options = options; + this.options = options ?? throw new ArgumentNullException( nameof( options ) ); options.AdHocModelBuilder.OnModelCreated += MarkAsAdHoc; } diff --git a/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/Conventions/ImplicitModelBoundSettingsConvention.cs b/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/Conventions/ImplicitModelBoundSettingsConvention.cs index 771af4de..a9be6fa3 100644 --- a/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/Conventions/ImplicitModelBoundSettingsConvention.cs +++ b/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/Conventions/ImplicitModelBoundSettingsConvention.cs @@ -13,6 +13,11 @@ public partial class ImplicitModelBoundSettingsConvention : IModelConfiguration, /// public void ApplyTo( ApiDescription apiDescription ) { + if ( apiDescription == null ) + { + throw new ArgumentNullException( nameof( apiDescription ) ); + } + var response = apiDescription.ResponseDescription; var type = response.ResponseType ?? response.DeclaredType;