Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ab0bb06

Browse filesBrowse files
Simplify and address possible NRE
1 parent 8293ab7 commit ab0bb06
Copy full SHA for ab0bb06

File tree

Expand file treeCollapse file tree

1 file changed

+7
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-10
lines changed

‎src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/ApiExplorer/ODataApiDescriptionProvider.cs

Copy file name to clipboardExpand all lines: src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/ApiExplorer/ODataApiDescriptionProvider.cs
+7-10Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,11 @@ private void UpdateModelTypes( ApiDescription description, IODataRoutingMetadata
380380
for ( var i = parameters.Count - 1; i >= 0; i-- )
381381
{
382382
var parameter = parameters[i];
383-
var type = parameter.Type;
383+
384+
if ( parameter.Type is not Type type )
385+
{
386+
continue;
387+
}
384388

385389
if ( type.IsODataQueryOptions() || type.IsODataPath() )
386390
{
@@ -414,16 +418,9 @@ private void UpdateModelTypes( ApiDescription description, IODataRoutingMetadata
414418
for ( var i = 0; i < responseTypes.Count; i++ )
415419
{
416420
var responseType = responseTypes[i];
417-
var type = responseType.Type;
418-
419-
if ( type == null )
420-
{
421-
continue;
422-
}
423-
424-
var modelMetadata = responseType.ModelMetadata;
425421

426-
if ( modelMetadata == null )
422+
if ( responseType.Type is not Type type ||
423+
responseType.ModelMetadata is not ModelMetadata modelMetadata )
427424
{
428425
continue;
429426
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.