Skip to content

Commit 4ff2176

Browse files
committed
clean up code block
1 parent 58e3cd6 commit 4ff2176

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Microsoft.OpenApi/Models/OpenApiSchema.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,17 +767,18 @@ private object DeepCloneType(object type)
767767
return type; // Return the string as is
768768
}
769769

770-
else
770+
if (type is Array array)
771771
{
772-
var array = type as Array;
773772
Type elementType = type.GetType().GetElementType();
774773
Array copiedArray = Array.CreateInstance(elementType, array.Length);
775-
for (int i = 0; i < array.Length; i++)
774+
for (int i = 0; i < array?.Length; i++)
776775
{
777-
copiedArray.SetValue(DeepCloneType(array.GetValue(i)), i);
776+
copiedArray.SetValue(DeepCloneType(array?.GetValue(i)), i);
778777
}
779778
return copiedArray;
780779
}
780+
781+
return null;
781782
}
782783
}
783784
}

0 commit comments

Comments
 (0)