From 9e30ffd3e08f24c4d812b0f79ff4db7a1b36a89e Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Wed, 28 Apr 2021 15:23:58 +0200 Subject: [PATCH] Fix #320620: Crash when filing with slashes on a certain score (see issue resp. forum topic, from an XML Import), multiple measures including the last. --- src/libmscore/cmd.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/libmscore/cmd.cpp b/src/libmscore/cmd.cpp index ab930e9744f2..d976a5b784fd 100644 --- a/src/libmscore/cmd.cpp +++ b/src/libmscore/cmd.cpp @@ -3454,13 +3454,15 @@ void Score::cmdSlashFill() // insert & turn into slash s = setNoteRest(s, track + voice, nv, f); Chord* c = toChord(s->element(track + voice)); - if (c->links()) { - for (ScoreElement* e : *c->links()) { - Chord* lc = toChord(e); - lc->setSlash(true, true); + if (c) { + if (c->links()) { + for (ScoreElement* e : *c->links()) { + Chord* lc = toChord(e); + lc->setSlash(true, true); + } + } else { + c->setSlash(true, true); } - } else { - c->setSlash(true, true); } lastSlash = c; if (!firstSlash) {