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 crash on invalid values in EditorPropertyArray/Dict #90265

Conversation

ajreckof
Copy link
Member

@ajreckof ajreckof commented Apr 5, 2024

@@ -328,6 +328,7 @@ void EditorPropertyArray::update_property() {
memdelete(container);
button_add_item = nullptr;
container = nullptr;
slots.clear();
Copy link
Member Author

Choose a reason for hiding this comment

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

this part missing was the one creating the crash

Comment on lines -589 to +590
get_edited_object()->set(get_edited_property(), array);
emit_changed(get_edited_property(), array);
Copy link
Member Author

Choose a reason for hiding this comment

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

this would have caused problem on nested arrays

Comment on lines -870 to +871
if (updated_val.get_type() == Variant::NIL) {
if (updated_val.get_type() != Variant::DICTIONARY) {
Copy link
Member Author

Choose a reason for hiding this comment

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

this is to not only check for null but for anything that wouldn't be treated well (only dictionary is expected) just as EditorPropertyArray checks with is_array.

@akien-mga akien-mga merged commit c493217 into godotengine:master Apr 5, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

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.

Export variable of array type will ignore its own type and use the value's type when pasting value
3 participants