From cbd2130bb4ac8853f9a161d23658d14986a56b25 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Sun, 11 Feb 2018 00:15:39 +0000 Subject: [PATCH] Apply opt to non-generic --- src/Kestrel.Core/Internal/Http/HttpProtocol.Generated.cs | 4 ++-- tools/CodeGenerator/HttpProtocolFeatureCollection.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Kestrel.Core/Internal/Http/HttpProtocol.Generated.cs b/src/Kestrel.Core/Internal/Http/HttpProtocol.Generated.cs index ed7eb1fd1..500a8c12b 100644 --- a/src/Kestrel.Core/Internal/Http/HttpProtocol.Generated.cs +++ b/src/Kestrel.Core/Internal/Http/HttpProtocol.Generated.cs @@ -86,7 +86,7 @@ object IFeatureCollection.this[Type key] { get { - object feature; + object feature = null; if (key == IHttpRequestFeatureType) { feature = _currentIHttpRequestFeature; @@ -171,7 +171,7 @@ object IFeatureCollection.this[Type key] { feature = _currentIHttpSendFileFeature; } - else + else if (MaybeExtra != null) { feature = ExtraFeatureGet(key); } diff --git a/tools/CodeGenerator/HttpProtocolFeatureCollection.cs b/tools/CodeGenerator/HttpProtocolFeatureCollection.cs index 69d787cf4..2e9d9b9f7 100644 --- a/tools/CodeGenerator/HttpProtocolFeatureCollection.cs +++ b/tools/CodeGenerator/HttpProtocolFeatureCollection.cs @@ -118,12 +118,12 @@ object IFeatureCollection.this[Type key] {{ get {{ - object feature;{Each(allFeatures, feature => $@" + object feature = null;{Each(allFeatures, feature => $@" {(feature.Index != 0 ? "else " : "")}if (key == {feature.Name}Type) {{ feature = _current{feature.Name}; }}")} - else + else if (MaybeExtra != null) {{ feature = ExtraFeatureGet(key); }}