summaryrefslogtreecommitdiff
path: root/gtk2_ardour/patch_change_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-06-02 14:53:34 +0000
committerCarl Hetherington <carl@carlh.net>2012-06-02 14:53:34 +0000
commitdcd6dbf14b795af7b5ad2422c925114a46c0ecf1 (patch)
treebb94921230fef285d77a51927c03682df8268ddd /gtk2_ardour/patch_change_dialog.cc
parentfd89d52af5ef353e787cdae621f6474c6251b908 (diff)
Persist track MIDNAM settings via a GUI property. Fix a
couple of crashes with the MIDNAM code. git-svn-id: svn://localhost/ardour2/branches/3.0@12543 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/patch_change_dialog.cc')
-rw-r--r--gtk2_ardour/patch_change_dialog.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk2_ardour/patch_change_dialog.cc b/gtk2_ardour/patch_change_dialog.cc
index 354cbfbf6a..c7b80a5480 100644
--- a/gtk2_ardour/patch_change_dialog.cc
+++ b/gtk2_ardour/patch_change_dialog.cc
@@ -171,7 +171,7 @@ PatchChangeDialog::set_active_bank_combo ()
boost::replace_all (n, "_", " ");
MIDI::Name::PatchPrimaryKey const * key = (*i)->patch_primary_key ();
- if (((key->msb << 7) | key->lsb) == _bank.get_value () - 1) {
+ if (key && ((key->msb << 7) | key->lsb) == _bank.get_value () - 1) {
_current_patch_bank = *i;
_ignore_signals = true;
_bank_combo.set_active_text (n);
@@ -210,15 +210,21 @@ PatchChangeDialog::bank_combo_changed ()
}
}
+ if (_current_patch_bank == 0) {
+ return;
+ }
+
/* Reflect */
fill_patch_combo ();
set_active_patch_combo ();
MIDI::Name::PatchPrimaryKey const * key = _current_patch_bank->patch_primary_key ();
- _ignore_signals = true;
- _bank.set_value (((key->msb << 7) | key->lsb) + 1);
- _ignore_signals = false;
+ if (key) {
+ _ignore_signals = true;
+ _bank.set_value (((key->msb << 7) | key->lsb) + 1);
+ _ignore_signals = false;
+ }
}
/** Fill the contents of the patch combo */