diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index 241a558eec..251d9f69b5 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -669,6 +669,9 @@ void ValueTree::copyPropertiesFrom (const ValueTree& source, UndoManager* undoMa { jassert (object != nullptr || source.object == nullptr); // Trying to add properties to a null ValueTree will fail! + if (source == *this) + return; + if (source.object == nullptr) removeAllProperties (undoManager); else if (object != nullptr) @@ -679,6 +682,9 @@ void ValueTree::copyPropertiesAndChildrenFrom (const ValueTree& source, UndoMana { jassert (object != nullptr || source.object == nullptr); // Trying to copy to a null ValueTree will fail! + if (source == *this) + return; + copyPropertiesFrom (source, undoManager); removeAllChildren (undoManager);