Skip to content

Commit

Permalink
Merge pull request #84237 from dalexeev/inspector-fix-array-dict-elem…
Browse files Browse the repository at this point in the history
…-clearing

Inspector: Fix clearing array/dictionary element with `<Object#null>`
  • Loading branch information
akien-mga committed Dec 5, 2023
2 parents dc367be + ed86c33 commit 4bc4817
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions editor/editor_properties_array_dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ void EditorPropertyArray::_property_changed(const String &p_property, Variant p_
return;
}

if (p_value.get_type() == Variant::OBJECT && p_value.is_null()) {
p_value = Variant(); // `EditorResourcePicker` resets to `Ref<Resource>()`. See GH-82716.
}

int index;
if (p_property.begins_with("metadata/")) {
index = p_property.get_slice("/", 2).to_int();
Expand Down Expand Up @@ -726,6 +730,10 @@ EditorPropertyArray::EditorPropertyArray() {
///////////////////// DICTIONARY ///////////////////////////

void EditorPropertyDictionary::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) {
if (p_value.get_type() == Variant::OBJECT && p_value.is_null()) {
p_value = Variant(); // `EditorResourcePicker` resets to `Ref<Resource>()`. See GH-82716.
}

if (p_property == "new_item_key") {
object->set_new_item_key(p_value);
} else if (p_property == "new_item_value") {
Expand Down

0 comments on commit 4bc4817

Please sign in to comment.