diff options
author | Robin Gareus <robin@gareus.org> | 2018-11-23 22:43:26 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-11-23 22:43:26 +0100 |
commit | 948c5d07065e862704da2d5f02207ed87ca821aa (patch) | |
tree | 8ebce66236217a1d487820348987aae181da102d /libs/midi++2 | |
parent | 771ddcc86fee434ccb2d06b5e28bc9274264a8f8 (diff) |
Handle some midnam edge-cases
Whitespace between XML nodes can result in "text" children.
Those need to be skipped in the patch-name list.
Diffstat (limited to 'libs/midi++2')
-rw-r--r-- | libs/midi++2/midnam_patch.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index af81dba0e0..71c82d78fd 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -113,7 +113,7 @@ int Patch::set_state (const XMLTree& tree, const XMLNode& node) { if (node.name() != "Patch") { - cerr << "Incorrect node " << node.name() << " handed to Patch" << endl; + cerr << "Incorrect node type '" << node.name() << "' handed to Patch" << endl; return -1; } @@ -437,8 +437,9 @@ PatchBank::set_state (const XMLTree& tree, const XMLNode& node) const XMLNodeList patches = patch_name_list->children(); for (XMLNodeList::const_iterator i = patches.begin(); i != patches.end(); ++i) { boost::shared_ptr<Patch> patch (new Patch (string(), 0, _number)); - patch->set_state(tree, *(*i)); - _patch_name_list.push_back(patch); + if (0 == patch->set_state(tree, *(*i))) { + _patch_name_list.push_back(patch); + } } } else { XMLNode* use_patch_name_list = node.child ("UsesPatchNameList"); |