Skip to content

Commit

Permalink
Merge pull request #89756 from zaevi/dotnet/fix_null_array
Browse files Browse the repository at this point in the history
C#: Fix errors when creating `Variant` from null array
  • Loading branch information
akien-mga committed Mar 24, 2024
2 parents 391eaf2 + 833a03f commit 3895639
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,28 @@ public static godot_variant CreateFromPackedColorArray(Span<Color> from)
}

public static godot_variant CreateFromSystemArrayOfStringName(Span<StringName> from)
=> CreateFromArray(new Collections.Array(from));
{
if (from == null)
return default;
using var fromGodot = new Collections.Array(from);
return CreateFromArray((godot_array)fromGodot.NativeValue);
}

public static godot_variant CreateFromSystemArrayOfNodePath(Span<NodePath> from)
=> CreateFromArray(new Collections.Array(from));
{
if (from == null)
return default;
using var fromGodot = new Collections.Array(from);
return CreateFromArray((godot_array)fromGodot.NativeValue);
}

public static godot_variant CreateFromSystemArrayOfRid(Span<Rid> from)
=> CreateFromArray(new Collections.Array(from));
{
if (from == null)
return default;
using var fromGodot = new Collections.Array(from);
return CreateFromArray((godot_array)fromGodot.NativeValue);
}

public static godot_variant CreateFromSystemArrayOfGodotObject(GodotObject[]? from)
{
Expand Down

0 comments on commit 3895639

Please sign in to comment.