diff --git a/Hi.UrlRewrite/Processing/Results/ProcessRequestResult.cs b/Hi.UrlRewrite/Processing/Results/ProcessRequestResult.cs index 1873593..db92d2d 100644 --- a/Hi.UrlRewrite/Processing/Results/ProcessRequestResult.cs +++ b/Hi.UrlRewrite/Processing/Results/ProcessRequestResult.cs @@ -10,10 +10,14 @@ public class ProcessRequestResult public ProcessRequestResult(Uri originalUri, RuleResult finalRuleResult, bool matchedAtLeastOneRule, List processedResults) { OriginalUri = originalUri; - RewrittenUri = finalRuleResult.RewrittenUri; MatchedAtLeastOneRule = matchedAtLeastOneRule; ProcessedResults = processedResults; - FinalAction = finalRuleResult.ResultAction; + + if (finalRuleResult != null) + { + RewrittenUri = finalRuleResult.RewrittenUri; + FinalAction = finalRuleResult.ResultAction; + } } public Uri OriginalUri { get; set; } diff --git a/Hi.UrlRewrite/Processing/UrlRewriter.cs b/Hi.UrlRewrite/Processing/UrlRewriter.cs index c3398a1..9497fdb 100644 --- a/Hi.UrlRewrite/Processing/UrlRewriter.cs +++ b/Hi.UrlRewrite/Processing/UrlRewriter.cs @@ -73,11 +73,6 @@ public ProcessRequestResult ProcessRequestUrl(Uri requestUri, List var lastMatchedRuleResult = processedResults.FirstOrDefault(r => r.RuleMatched); - if (lastMatchedRuleResult == null) - { - return null; - } - var finalResult = new ProcessRequestResult(originalUri, lastMatchedRuleResult, matchedAtLeastOneRule, processedResults); return finalResult;