mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Added some assertions to ValueTree
This commit is contained in:
parent
c586e91c7f
commit
66cd90e4af
1 changed files with 6 additions and 1 deletions
|
|
@ -757,7 +757,8 @@ var ValueTree::getProperty (const Identifier& name, const var& defaultReturnValu
|
|||
ValueTree& ValueTree::setProperty (const Identifier& name, const var& newValue,
|
||||
UndoManager* const undoManager)
|
||||
{
|
||||
jassert (name.toString().isNotEmpty());
|
||||
jassert (name.toString().isNotEmpty()); // Must have a valid property name!
|
||||
jassert (object != nullptr); // Trying to add a property to a null ValueTree will fail!
|
||||
|
||||
if (object != nullptr)
|
||||
object->setProperty (name, newValue, undoManager);
|
||||
|
|
@ -795,6 +796,8 @@ Identifier ValueTree::getPropertyName (const int index) const
|
|||
|
||||
void ValueTree::copyPropertiesFrom (const ValueTree& source, UndoManager* const undoManager)
|
||||
{
|
||||
jassert (object != nullptr || source.object == nullptr); // Trying to add properties to a null ValueTree will fail!
|
||||
|
||||
if (source.object == nullptr)
|
||||
removeAllProperties (undoManager);
|
||||
else if (object != nullptr)
|
||||
|
|
@ -885,6 +888,8 @@ int ValueTree::indexOf (const ValueTree& child) const
|
|||
|
||||
void ValueTree::addChild (const ValueTree& child, int index, UndoManager* const undoManager)
|
||||
{
|
||||
jassert (object != nullptr); // Trying to add a child to a null ValueTree!
|
||||
|
||||
if (object != nullptr)
|
||||
object->addChild (child.object, index, undoManager);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue