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
This commit is contained in:
Paul Davis
2009-10-20 12:16:30 +00:00
parent 0def2d2d82
commit b488867f32

View File

@@ -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> >();
}