summaryrefslogtreecommitdiff
path: root/libs/midi++2
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-12-30 16:24:27 +0100
committerRobin Gareus <robin@gareus.org>2013-12-30 16:24:27 +0100
commite281f5653c804f0eae07bd541f812b9534ec37e9 (patch)
tree8cf04cd25bbc05690d18257f31e2d9558fd0b12a /libs/midi++2
parent7e857b226440cb1ad396e448b1af6e6c958fae28 (diff)
fix assert for non-existing MIDI patch-names
typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = MIDI::Name::ChannelNameSet; typename boost::detail::sp_member_access<T>::type = MIDI::Name::ChannelNameSet*]: Assertion `px != 0' failed.
Diffstat (limited to 'libs/midi++2')
-rw-r--r--libs/midi++2/midnam_patch.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc
index bf22792f70..bd8bbfc42d 100644
--- a/libs/midi++2/midnam_patch.cc
+++ b/libs/midi++2/midnam_patch.cc
@@ -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>