diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-08-11 15:58:28 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-08-11 15:58:28 +0000 |
commit | 1f845c0e326c713a2a99c22d269a2b765b507a4f (patch) | |
tree | 5ac454e543a5878bfed89430a0d06a170497583e /libs | |
parent | dd6e76ad89a22c517636b6fb010626308f571eb8 (diff) |
do not assert/abort out of data errors that may originate with external user-supplied data, and use PBD::error instead
git-svn-id: svn://localhost/ardour2/branches/3.0@9978 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/evoral/src/Sequence.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp index 00ae5d5cfa..0ca0537ac9 100644 --- a/libs/evoral/src/Sequence.cpp +++ b/libs/evoral/src/Sequence.cpp @@ -25,6 +25,7 @@ #include <cstdio> #include "pbd/compose.h" +#include "pbd/error.h" #include "evoral/Control.hpp" #include "evoral/ControlList.hpp" @@ -35,6 +36,8 @@ #include "evoral/TypeMap.hpp" #include "evoral/midi_util.h" +#include "i18n.h" + using namespace std; using namespace PBD; @@ -874,10 +877,17 @@ Sequence<Time>::append_note_on_unlocked (NotePtr note, event_id_t evid) DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 c=%2 note %3 on @ %4 v=%5\n", this, (int) note->channel(), (int) note->note(), note->time(), (int) note->velocity())); - assert(note->note() <= 127); - assert(note->channel() < 16); assert(_writing); + if (note->note() > 127) { + error << string_compose (_("illegal note number (%1) used in Note event - event will be ignored"), note->note()) << endmsg; + return; + } + if (note->channel() >= 16) { + error << string_compose (_("illegal channel number (%1) used in Note event - event will be ignored"), note->channel()) << endmsg; + return; + } + if (note->id() < 0) { note->set_id (evid); } |