Skip to content

Commit

Permalink
fix #280771 midi entry on empty voice
Browse files Browse the repository at this point in the history
Previous code would crash because cr would (correctly) be set to NULL when there are no elements in a particular track of input state's last segment.  Once case this situtation occurs is when inputting midi for with a voice that hasn't been used before.  This commit prevents this crash by making sure cr is non-NULL before testing if it is a chord.
  • Loading branch information
Eric Fontaine committed Dec 28, 2018
1 parent 1cf599c commit e2950ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libmscore/cmd.cpp
Expand Up @@ -2001,7 +2001,7 @@ bool Score::processMidiInput()
ev.chord = true;

Element* cr = _is.lastSegment()->element(_is.track());
if (cr->isChord()) {
if (cr && cr->isChord()) {
Note* n = toChord(cr)->findNote(ev.pitch);
if (n) {
deleteItem(n->tieBack());
Expand Down

0 comments on commit e2950ad

Please sign in to comment.