summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_model.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-10-20 12:16:30 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-10-20 12:16:30 +0000
commitb488867f32b1ae46a776a3e1c3c1c8eb3b4ce419 (patch)
tree2eb6d0558c48fbc4d4553db6f960e82bfc0014a4 /libs/ardour/midi_model.cc
parent0def2d2d82936b5d4a7e1aa30807bc00f5972b23 (diff)
handle searching for a note in an empty note list
git-svn-id: svn://localhost/ardour2/branches/3.0@5822 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_model.cc')
-rw-r--r--libs/ardour/midi_model.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc
index 06beb4fa48..851ee49b46 100644
--- a/libs/ardour/midi_model.cc
+++ b/libs/ardour/midi_model.cc
@@ -719,10 +719,15 @@ MidiModel::get_state()
boost::shared_ptr<Evoral::Note<MidiModel::TimeType> >
MidiModel::find_note (boost::shared_ptr<Evoral::Note<TimeType> > other)
{
- for (Notes::iterator l = notes().lower_bound(other); (*l)->time() == other->time(); ++l) {
- if (*l == other) {
- return *l;
+ Notes::iterator l = notes().lower_bound(other);
+
+ if (l != notes().end()) {
+ for (; (*l)->time() == other->time(); ++l) {
+ if (*l == other) {
+ return *l;
+ }
}
}
+
return boost::shared_ptr<Evoral::Note<TimeType> >();
}