Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix C# array null handling #82388

Closed
wants to merge 1 commit into from

Conversation

SaNeOr
Copy link
Contributor

@SaNeOr SaNeOr commented Sep 26, 2023

close #82362

@SaNeOr SaNeOr requested a review from a team as a code owner September 26, 2023 18:04
@YuriSizov YuriSizov added this to the 4.x milestone Sep 26, 2023
Copy link
Member

@RedworkDE RedworkDE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is the correct fix as there isn't really a null Span, instead null equals to an empty span, thus I'd argue that the throw from the Array constructor as currently there is no way to create a Godot.Array from an empty array. If the behavior of converting a null StringName[] to a nil variant is desired such a check has to be added at a different point.

@SaNeOr
Copy link
Contributor Author

SaNeOr commented Sep 27, 2023

I do not think that this is the correct fix as there isn't really a null Span, instead null equals to an empty span, thus I'd argue that the throw from the Array constructor as currently there is no way to create a Godot.Array from an empty array. If the behavior of converting a null StringName[] to a nil variant is desired such a check has to be added at a different point.

But the way it actually works at the moment is that if you pass null directly to CreateFromArray, it still returns default(godot_variant).

@SaNeOr
Copy link
Contributor Author

SaNeOr commented Sep 29, 2023

@RedworkDE Is it correct to refer to a new array when span is empty?

@akien-mga
Copy link
Member

Superseded by #89756. Thanks for the contribution!

@akien-mga akien-mga closed this Mar 24, 2024
@akien-mga akien-mga removed this from the 4.x milestone Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exporting NodePath as a C# array don't work
4 participants