fixed crash on score load
This commit is contained in:
parent
a6a525d1e4
commit
1ad1ecc821
2 changed files with 10 additions and 3 deletions
|
@ -37,6 +37,8 @@
|
|||
#include "clef.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "log.h"
|
||||
|
||||
using namespace mu;
|
||||
using namespace mu::engraving;
|
||||
|
||||
|
@ -142,7 +144,7 @@ bool Score::sanityCheck(const QString& name)
|
|||
if (voices[0] != mLen) {
|
||||
QString msg = QObject::tr("Measure %1, staff %2 incomplete. Expected: %3; Found: %4").arg(mNumber).arg(staffIdx + 1).arg(
|
||||
mLen.print(), voices[0].print());
|
||||
qDebug() << msg;
|
||||
LOGE() << msg;
|
||||
error += QString("%1\n").arg(msg);
|
||||
#ifndef NDEBUG
|
||||
m->setCorrupted(staffIdx, true);
|
||||
|
@ -161,7 +163,7 @@ bool Score::sanityCheck(const QString& name)
|
|||
if (voices[v] > mLen) {
|
||||
QString msg = QObject::tr("Measure %1, staff %2, voice %3 too long. Expected: %4; Found: %5").arg(mNumber).arg(
|
||||
staffIdx + 1).arg(v + 1).arg(mLen.print(), voices[v].print());
|
||||
qDebug() << msg;
|
||||
LOGE() << msg;
|
||||
error += QString("%1\n").arg(msg);
|
||||
#ifndef NDEBUG
|
||||
m->setCorrupted(staffIdx, true);
|
||||
|
|
|
@ -1954,6 +1954,10 @@ static void fixTies(Chord* chord)
|
|||
}
|
||||
for (Note* note : notes) {
|
||||
Note* endNote = chord->findNote(note->pitch());
|
||||
Note* oldNote = note->tieFor()->endNote();
|
||||
if (oldNote) {
|
||||
oldNote->setTieBack(nullptr);
|
||||
}
|
||||
note->tieFor()->setEndNote(endNote);
|
||||
}
|
||||
}
|
||||
|
@ -3365,7 +3369,8 @@ bool Read206::readScore206(Score* score, XmlReader& e, ReadContext& ctx)
|
|||
|
||||
ex->setPartScore(s);
|
||||
e.setLastMeasure(nullptr);
|
||||
readScore206(s, e, ctx);
|
||||
ReadContext exCtx(s);
|
||||
readScore206(s, e, exCtx);
|
||||
ex->setTracks(e.tracks());
|
||||
m->addExcerpt(ex);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue