summaryrefslogtreecommitdiff
path: root/editor/editor_inspector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r--editor/editor_inspector.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index c8baecaaaf..46cc9336be 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -3086,12 +3086,20 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo
} else {
undo_redo->create_action(vformat(TTR("Set %s"), p_name), UndoRedo::MERGE_ENDS);
undo_redo->add_do_property(object, p_name, p_value);
- undo_redo->add_undo_property(object, p_name, object->get(p_name));
+ bool valid = false;
+ Variant value = object->get(p_name, &valid);
+ if (valid) {
+ undo_redo->add_undo_property(object, p_name, value);
+ }
PropertyInfo prop_info;
if (ClassDB::get_property_info(object->get_class_name(), p_name, &prop_info)) {
for (const String &linked_prop : prop_info.linked_properties) {
- undo_redo->add_undo_property(object, linked_prop, object->get(linked_prop));
+ valid = false;
+ value = object->get(linked_prop, &valid);
+ if (valid) {
+ undo_redo->add_undo_property(object, linked_prop, value);
+ }
}
}