Skip to content

Conversation

@Jojo-Schmitz
Copy link
Contributor

Resolves: #30693

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;
Copy link
Contributor Author

@Jojo-Schmitz Jojo-Schmitz Oct 23, 2025

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());
Copy link
Contributor Author

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());
Copy link
Contributor Author

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...

@cbjeukendrup
Copy link
Member

I think we should rather try to solve the problem at the source. A fermata with no segment during layout should not happen...

@Jojo-Schmitz
Copy link
Contributor Author

Jojo-Schmitz commented Oct 23, 2025

Apparently it does though. Seems gracenotes after are involved somehow
Anyway, this is as far as I got with this.

if (item->isStyled(Pid::OFFSET)) {
y += item->offset().y();
}
if (!item->segment()) {
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MuseScore 4.6.3 crashes with MusicXML without error message

2 participants