From f7639dc7233c3f2b89cc6aab1b5308ed34042f9e Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Sat, 29 May 2021 17:55:02 +0200 Subject: [PATCH] Fix #321730: Crash on corrupt MXL import --- importexport/musicxml/importmxmlpass2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index 35699718fc147..125769af3e2c2 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -1579,8 +1579,9 @@ void MusicXMLParserPass2::scorePartwise() } // set last measure barline to normal or MuseScore will generate light-heavy EndBarline // TODO, handle other tracks? - if (_score->lastMeasure()->endBarLineType() == BarLineType::NORMAL) - _score->lastMeasure()->setEndBarLineType(BarLineType::NORMAL, 0); + auto lm = _score->lastMeasure(); + if (lm && lm->endBarLineType() == BarLineType::NORMAL) + lm->setEndBarLineType(BarLineType::NORMAL, 0); } //---------------------------------------------------------