Skip to content

Commit aa80b19

Browse files
committed
fix: do not allow null argument for example copy constructor
Signed-off-by: Vincent Biret <[email protected]>
1 parent 77e0ad1 commit aa80b19

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Microsoft.OpenApi/Models/OpenApiExample.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ public OpenApiExample() { }
4141
/// <param name="example">The <see cref="IOpenApiExample"/> object</param>
4242
public OpenApiExample(IOpenApiExample example)
4343
{
44-
Summary = example?.Summary ?? Summary;
45-
Description = example?.Description ?? Description;
46-
Value = example?.Value != null ? JsonNodeCloneHelper.Clone(example.Value) : null;
47-
ExternalValue = example?.ExternalValue ?? ExternalValue;
48-
Extensions = example?.Extensions != null ? new Dictionary<string, IOpenApiExtension>(example.Extensions) : null;
44+
Utils.CheckArgumentNull(example);
45+
Summary = example.Summary ?? Summary;
46+
Description = example.Description ?? Description;
47+
Value = example.Value != null ? JsonNodeCloneHelper.Clone(example.Value) : null;
48+
ExternalValue = example.ExternalValue ?? ExternalValue;
49+
Extensions = example.Extensions != null ? new Dictionary<string, IOpenApiExtension>(example.Extensions) : null;
4950
}
5051

5152
/// <inheritdoc/>

0 commit comments

Comments
 (0)