Skip to content

Commit e0aba68

Browse files
committed
chore: code linting
Signed-off-by: Vincent Biret <[email protected]>
1 parent be3c552 commit e0aba68

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,12 @@ public T LoadElement<T>(ParseNode node, OpenApiDocument doc) where T : IOpenApiE
183183
/// <inheritdoc />
184184
public string GetReferenceScalarValues(MapNode mapNode, string scalarValue)
185185
{
186-
if (mapNode.Any(static x => !"$ref".Equals(x.Name, StringComparison.OrdinalIgnoreCase)))
186+
if (mapNode.Any(static x => !"$ref".Equals(x.Name, StringComparison.OrdinalIgnoreCase)) &&
187+
mapNode
188+
.Where(x => x.Name.Equals(scalarValue))
189+
.Select(static x => x.Value)
190+
.OfType<ValueNode>().FirstOrDefault() is {} valueNode)
187191
{
188-
var valueNode = mapNode.Where(x => x.Name.Equals(scalarValue))
189-
.Select(static x => x.Value).OfType<ValueNode>().FirstOrDefault();
190-
191192
return valueNode.GetScalarValue();
192193
}
193194

0 commit comments

Comments
 (0)