Skip to content

Commit

Permalink
C#: Fix errors when creating Variant from null array
Browse files Browse the repository at this point in the history
  • Loading branch information
zaevi committed Mar 21, 2024
1 parent fe01776 commit 833a03f
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 833a03f

Please sign in to comment.