diff --git a/src/bunit.web.query/Labels/Strategies/LabelTextUsingWrappedElementStrategy.cs b/src/bunit.web.query/Labels/Strategies/LabelTextUsingWrappedElementStrategy.cs index cd7f3c87c..e0335c054 100644 --- a/src/bunit.web.query/Labels/Strategies/LabelTextUsingWrappedElementStrategy.cs +++ b/src/bunit.web.query/Labels/Strategies/LabelTextUsingWrappedElementStrategy.cs @@ -14,9 +14,6 @@ internal sealed class LabelTextUsingWrappedElementStrategy : ILabelTextQueryStra .Children .SingleOrDefault(n => n.IsHtmlElementThatCanHaveALabel()); - if (matchingElement is null) - return null; - - return matchingElement.WrapUsing(new ByLabelTextElementFactory(renderedFragment, labelText, options)); + return matchingElement?.WrapUsing(new ByLabelTextElementFactory(renderedFragment, labelText, options)); } }