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

Assign return value on Variant operator failure #95166

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

aaronp64
Copy link
Contributor

@aaronp64 aaronp64 commented Aug 5, 2024

Variant operators for String formatting and in could result in errors, which would return from validated_evaluate without assigning r_ret. This would cause scripts using the return value from these operators to get results from previously run code. Updated to return the original String value in the String formatting case, and false for in when an error occurs.

Fixes #95152

@aaronp64 aaronp64 requested a review from a team as a code owner August 5, 2024 15:44
@AThousandShips AThousandShips added bug topic:core cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release labels Aug 5, 2024
@AThousandShips AThousandShips added this to the 4.4 milestone Aug 5, 2024
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

I'm not familiar with the internals there so I'm not sure what this assignment of left to r_ret means, but if it fixes the issue, overall the change seems sane to me.

@aaronp64 aaronp64 force-pushed the variant_op_err_return branch from 4e741eb to d22865f Compare September 19, 2024 15:10
Variant operators for String formatting and "in" could result in errors, which would return from validated_evaluate without assigning r_ret.  This would cause scripts using the return value from these operators to get results from previously run code.  Updated to return the original String value in the String formatting case, and false for "in" when an error occurs.
@aaronp64 aaronp64 force-pushed the variant_op_err_return branch from d22865f to 714357e Compare September 19, 2024 15:22
@akien-mga akien-mga merged commit 1b19ecb into godotengine:master Sep 23, 2024
19 checks passed
@akien-mga
Copy link
Member

Thanks!

@aaronp64 aaronp64 deleted the variant_op_err_return branch September 23, 2024 13:04
@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release topic:core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

String format and in operator can return unexpected values on failure
3 participants