Skip to content

Commit

Permalink
fix #180986: crash on ctrl+home of empty score
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Mar 14, 2017
1 parent 260d790 commit ddc1de6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libmscore/navigate.cpp
Expand Up @@ -273,7 +273,8 @@ Note* Score::downAltCtrl(Note* note) const

Element* Score::firstElement()
{
return firstSegment(SegmentType::All)->element(0);
Segment *s = firstSegment(SegmentType::All);
return s ? s->element(0) : nullptr;
}

//---------------------------------------------------------
Expand All @@ -282,8 +283,10 @@ Element* Score::firstElement()

Element* Score::lastElement()
{
Element* re =0;
Segment* seg = this->lastSegment();
Element* re = 0;
Segment* seg = lastSegment();
if (!seg)
return nullptr;
while (true) {
for (int i = (staves().size() -1) * VOICES; i < staves().size() * VOICES; i++) {
if (seg->element(i))
Expand Down

0 comments on commit ddc1de6

Please sign in to comment.