Merge windows+cc branch into cairocanvas branch. Not finished, need to now merge...
[ardour.git] / libs / midi++2 / midnam_patch.cc
index 0498168843ed2fd4f8cc1673eed948be7d4055ac..9dd5bc33db4ca3c3a77308d39e11c8c53175e8df 100644 (file)
@@ -542,7 +542,9 @@ MasterDeviceNames::channel_name_set_by_device_mode_and_channel(const std::string
 boost::shared_ptr<Patch> 
 MasterDeviceNames::find_patch(const std::string& mode, uint8_t channel, const PatchPrimaryKey& key) 
 {
-       return channel_name_set_by_device_mode_and_channel(mode, channel)->find_patch(key);
+       boost::shared_ptr<ChannelNameSet> cns = channel_name_set_by_device_mode_and_channel(mode, channel);
+       if (!cns) return boost::shared_ptr<Patch>();
+       return cns->find_patch(key);
 }
 
 boost::shared_ptr<ChannelNameSet>