Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/engraving/rendering/score/tlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,7 @@ void TLayout::layoutFermata(const Fermata* item, Fermata::LayoutData* ldata)
double x = 0.0;
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


if (e) {
LD_CONDITION(e->ldata()->isSetBbox()); // e->shape()
Expand Down Expand Up @@ -2227,6 +2227,9 @@ void TLayout::layoutFermata(const Fermata* item, Fermata::LayoutData* ldata)
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

return;
}
Shape staffShape = item->segment()->staffShape(item->staffIdx());
staffShape.removeTypes({ ElementType::FERMATA });
if (item->placeAbove()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5178,7 +5178,7 @@ void MusicXmlParserDirection::dashes(const String& type, const int number,
{
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

// if (placement.empty()) placement = "above"; // TODO ? set default

// hack: combine with a previous words element
Expand All @@ -5202,7 +5202,7 @@ void MusicXmlParserDirection::dashes(const String& type, const int number,
// use MusicXML specific type instead
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...

stops.push_back(MusicXmlSpannerDesc(b, ElementType::TEXTLINE, number));
}
m_e.skipCurrentElement();
Expand Down
Loading