Don't create empty description nodes.

Other places e.g. Route::save_as_template(), Session::save_template()
don't to that either.
This commit is contained in:
Robin Gareus 2017-08-30 17:45:14 +02:00
parent 1f6c54a2f0
commit 4c077010ad

View File

@ -429,10 +429,12 @@ TemplateManager::save_template_desc ()
}
tree.root()->remove_nodes_and_delete (X_("description"));
XMLNode* desc = new XMLNode (X_("description"));
XMLNode* dn = new XMLNode (X_("content"), desc_txt);
desc->add_child_nocopy (*dn);
if (!desc_txt.empty ()) {
XMLNode* desc = new XMLNode (X_("description"));
XMLNode* dn = new XMLNode (X_("content"), desc_txt);
desc->add_child_nocopy (*dn);
}
tree.root()->add_child_nocopy (*desc);