Skip to content

Commit

Permalink
add ! to avoid nullable warning
Browse files Browse the repository at this point in the history
  • Loading branch information
dameng324 committed Sep 25, 2024
1 parent 2e0fc76 commit 3fc207f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private static void FallbackToHttp(HttpRequestMessage request)
{
var uriBuilder = new UriBuilder(request.RequestUri!);
uriBuilder.Scheme = "http";
if(request.RequestUri.IsDefaultPort)
if(request.RequestUri!.IsDefaultPort)
uriBuilder.Port = -1;
request.RequestUri = uriBuilder.Uri;
}
Expand Down

1 comment on commit 3fc207f

@baronfel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way you can get around this nullable warning is to use the property on the UriBuilder: if(uriBuilder.Uri.IsDefaultPort)....

Please sign in to comment.