-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix crash when loading a certain MusicXML file #30698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| double y = item->placeAbove() ? 0.0 : item->staff()->staffHeight(item->tick()); | ||
| const Segment* s = item->segment(); | ||
| const EngravingItem* e = s->element(item->track()); | ||
| const EngravingItem* e = s ? s->element(item->track()) : nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent dereferencing a nullptr. We might want to use IF_ASSERF_FAILED()` here
| const MusicXmlExtendedSpannerDesc& spdesc = m_pass2.getSpanner({ ElementType::HAIRPIN, number }); | ||
| if (type == u"start") { | ||
| TextLineBase* b = spdesc.isStopped ? toTextLine(spdesc.sp) : Factory::createTextLine(m_score->dummy()); | ||
| TextLineBase* b = spdesc.isStopped && spdesc.sp->isTextLine() ? toTextLine(spdesc.sp) : Factory::createTextLine(m_score->dummy()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent a crash in Debug builds
| starts.push_back(MusicXmlSpannerDesc(b, ElementType::TEXTLINE, number)); | ||
| } else if (type == u"stop") { | ||
| TextLine* b = spdesc.isStarted ? toTextLine(spdesc.sp) : Factory::createTextLine(m_score->dummy()); | ||
| TextLine* b = spdesc.isStarted && spdesc.sp->isTextLine() ? toTextLine(spdesc.sp) : Factory::createTextLine(m_score->dummy()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It so far didn't crash here, but I'd rather be consistent and safe than sorry...
|
I think we should rather try to solve the problem at the source. A fermata with no segment during layout should not happen... |
|
Apparently it does though. Seems gracenotes after are involved somehow |
f8ece57 to
bdb120e
Compare
| if (item->isStyled(Pid::OFFSET)) { | ||
| y += item->offset().y(); | ||
| } | ||
| if (!item->segment()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent dereferencing a nullptr. We might want to use IF_ASSERT_FAILED()` here
Resolves: #30693