fix crash when opening a session created before the midnam-channel GUI property existed

This commit is contained in:
Paul Davis 2023-08-20 09:18:25 -06:00
parent 511c3ef048
commit 776d8590f9
1 changed files with 12 additions and 8 deletions

View File

@ -471,16 +471,20 @@ PianoRollHeader::get_note_name (int note)
if (mtv) {
string chn = mtv->gui_property (X_("midnam-channel"));
int midnam_channel;
sscanf (chn.c_str(), "%*s %d", &midnam_channel);
midnam_channel--;
if (!chn.empty()) {
name = mtv->route()->instrument_info ().get_note_name (
0, //bank
0, //program
midnam_channel, //channel
note); //note
int midnam_channel;
sscanf (chn.c_str(), "%*s %d", &midnam_channel);
midnam_channel--;
name = mtv->route()->instrument_info ().get_note_name (
0, //bank
0, //program
midnam_channel, //channel
note); //note
}
}
int oct_rel = note % 12;