Skip to content

Commit

Permalink
fix #308860: crash on adding breath or rest to palette
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz committed Aug 18, 2020
1 parent bd675e7 commit ac59684
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libmscore/breath.cpp
Expand Up @@ -63,7 +63,7 @@ bool Breath::isCaesura() const

void Breath::layout()
{
bool palette = (track() == -1);
bool palette = (!staff() || track() == -1);
if (!palette) {
int voiceOffset = placeBelow() * (staff()->lines(tick()) - 1) * spatium();
if (isCaesura())
Expand Down
4 changes: 2 additions & 2 deletions libmscore/rest.cpp
Expand Up @@ -429,7 +429,7 @@ void Rest::layout()

qreal yOff = offset().y();
const Staff* stf = staff();
const StaffType* st = stf->staffTypeForElement(this);
const StaffType* st = stf ? stf->staffTypeForElement(this) : 0;
qreal lineDist = st ? st->lineDistance().val() : 1.0;
int userLine = yOff == 0.0 ? 0 : lrint(yOff / (lineDist * _spatium));
int lines = st ? st->lines() : 5;
Expand Down Expand Up @@ -786,7 +786,7 @@ void Rest::reset()

qreal Rest::mag() const
{
qreal m = staff()->mag(this);
qreal m = staff() ? staff()->mag(this) : 1.0;
if (small())
m *= score()->styleD(Sid::smallNoteMag);
return m;
Expand Down

0 comments on commit ac59684

Please sign in to comment.