-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -328,6 +328,7 @@ void EditorPropertyArray::update_property() { | |
memdelete(container); | ||
button_add_item = nullptr; | ||
container = nullptr; | ||
slots.clear(); | ||
} | ||
return; | ||
} | ||
|
@@ -586,7 +587,7 @@ void EditorPropertyArray::_edit_pressed() { | |
Variant array = get_edited_property_value(); | ||
if (!array.is_array() && edit->is_pressed()) { | ||
initialize_array(array); | ||
get_edited_object()->set(get_edited_property(), array); | ||
emit_changed(get_edited_property(), array); | ||
Comment on lines
-589
to
+590
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this would have caused problem on nested arrays |
||
} | ||
|
||
get_edited_object()->editor_set_section_unfold(get_edited_property(), edit->is_pressed()); | ||
|
@@ -867,14 +868,15 @@ void EditorPropertyDictionary::setup(PropertyHint p_hint) { | |
void EditorPropertyDictionary::update_property() { | ||
Variant updated_val = get_edited_property_value(); | ||
|
||
if (updated_val.get_type() == Variant::NIL) { | ||
if (updated_val.get_type() != Variant::DICTIONARY) { | ||
Comment on lines
-870
to
+871
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is to not only check for |
||
edit->set_text(TTR("Dictionary (Nil)")); // This provides symmetry with the array property. | ||
edit->set_pressed(false); | ||
if (container) { | ||
set_bottom_editor(nullptr); | ||
memdelete(container); | ||
button_add_item = nullptr; | ||
container = nullptr; | ||
slots.clear(); | ||
} | ||
return; | ||
} | ||
|
@@ -1021,7 +1023,7 @@ void EditorPropertyDictionary::_edit_pressed() { | |
Variant prop_val = get_edited_property_value(); | ||
if (prop_val.get_type() == Variant::NIL && edit->is_pressed()) { | ||
VariantInternal::initialize(&prop_val, Variant::DICTIONARY); | ||
get_edited_object()->set(get_edited_property(), prop_val); | ||
emit_changed(get_edited_property(), prop_val); | ||
} | ||
|
||
get_edited_object()->editor_set_section_unfold(get_edited_property(), edit->is_pressed()); | ||
|
There was a problem hiding this comment.
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