fix jack transport return value
[ardour.git] / libs / midi++2 / midnam_patch.cc
index 252804e4669857bf0b0e90c2d1d7bc7a02851b3f..bf841e9a68e398fbe7f991d00e9f6618427ddd3d 100644 (file)
@@ -724,14 +724,13 @@ MasterDeviceNames::note_name(const std::string& mode_name,
                return "";
        }
 
+       boost::shared_ptr<const NoteNameList> note_names;
        boost::shared_ptr<const Patch> patch(
                find_patch(mode_name, channel, PatchPrimaryKey(program, bank)));
-       if (!patch) {
-               return "";
+       if (patch) {
+               note_names = note_name_list(patch->note_list_name());
        }
 
-       boost::shared_ptr<const NoteNameList> note_names(
-               note_name_list(patch->note_list_name()));
        if (!note_names) {
                /* No note names specific to this patch, check the ChannelNameSet */
                boost::shared_ptr<ChannelNameSet> chan_names = channel_name_set_by_channel(
@@ -878,12 +877,13 @@ MasterDeviceNames::get_state(void)
 
 MIDINameDocument::MIDINameDocument (const string& filename)
 {
-       if (!_document.read (filename)) {
+       XMLTree document;
+       if (!document.read (filename)) {
                throw failed_constructor ();
        }
 
-       _document.set_filename (filename);
-       set_state (_document, *_document.root());
+       document.set_filename (filename);
+       set_state (document, *document.root());
 }
 
 int