summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-09-10 21:19:01 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-09-10 21:19:01 +0000
commit2ff1cd99af1b32434819c9dc48f1c5459837eaa3 (patch)
tree1f73efc0b418a1b9c225a748eb091b9e4a34186f /libs
parent7b8adc78b6082efb2c46822ddb5d8347a4e20e9e (diff)
do not crash when loading old history files with MIDI edits; add all notes in region to canvas, but pay attention to visibility
git-svn-id: svn://localhost/ardour2/branches/3.0@5652 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/midi_model.cc27
1 files changed, 17 insertions, 10 deletions
diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc
index 95d6d6a924..80c5759896 100644
--- a/libs/ardour/midi_model.cc
+++ b/libs/ardour/midi_model.cc
@@ -267,15 +267,19 @@ MidiModel::DeltaCommand::set_state(const XMLNode& delta_command)
_added_notes.clear();
XMLNode* added_notes = delta_command.child(ADDED_NOTES_ELEMENT);
- XMLNodeList notes = added_notes->children();
- transform(notes.begin(), notes.end(), back_inserter(_added_notes),
- sigc::mem_fun(*this, &DeltaCommand::unmarshal_note));
+ if (added_notes) {
+ XMLNodeList notes = added_notes->children();
+ transform(notes.begin(), notes.end(), back_inserter(_added_notes),
+ sigc::mem_fun(*this, &DeltaCommand::unmarshal_note));
+ }
_removed_notes.clear();
XMLNode* removed_notes = delta_command.child(REMOVED_NOTES_ELEMENT);
- notes = removed_notes->children();
- transform(notes.begin(), notes.end(), back_inserter(_removed_notes),
- sigc::mem_fun(*this, &DeltaCommand::unmarshal_note));
+ if (removed_notes) {
+ XMLNodeList notes = removed_notes->children();
+ transform(notes.begin(), notes.end(), back_inserter(_removed_notes),
+ sigc::mem_fun(*this, &DeltaCommand::unmarshal_note));
+ }
return 0;
}
@@ -620,11 +624,14 @@ MidiModel::DiffCommand::set_state(const XMLNode& diff_command)
_changes.clear();
XMLNode* changed_notes = diff_command.child(DIFF_NOTES_ELEMENT);
- XMLNodeList notes = changed_notes->children();
- transform (notes.begin(), notes.end(), back_inserter(_changes),
- sigc::mem_fun(*this, &DiffCommand::unmarshal_change));
-
+ if (changed_notes) {
+ XMLNodeList notes = changed_notes->children();
+
+ transform (notes.begin(), notes.end(), back_inserter(_changes),
+ sigc::mem_fun(*this, &DiffCommand::unmarshal_change));
+ }
+
return 0;
}