Commit 78ebd145 authored by beder's avatar beder
Browse files

Switched Node::operator=(const Node&) to *not* force itself to create its node...

Switched Node::operator=(const Node&) to *not* force itself to create its node first (since we're just assigning them)
parent 04152dae
...@@ -138,9 +138,14 @@ namespace YAML ...@@ -138,9 +138,14 @@ namespace YAML
inline void Node::AssignNode(const Node& rhs) inline void Node::AssignNode(const Node& rhs)
{ {
EnsureNodeExists();
rhs.EnsureNodeExists(); rhs.EnsureNodeExists();
if(!m_pNode) {
m_pNode = rhs.m_pNode;
m_pMemory = rhs.m_pMemory;
return;
}
m_pNode->set_ref(*rhs.m_pNode); m_pNode->set_ref(*rhs.m_pNode);
m_pMemory->merge(*rhs.m_pMemory); m_pMemory->merge(*rhs.m_pMemory);
m_pNode = rhs.m_pNode; m_pNode = rhs.m_pNode;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment