Improve handling of empty songs

This commit is contained in:
Matthias Neeracher 2011-08-26 17:26:24 +00:00
parent 4a5e1574ca
commit 83194fc368
2 changed files with 7 additions and 0 deletions

View File

@ -2288,6 +2288,8 @@ void VLSongVisitor::VisitMeasures(VLSong & song, bool performanceOrder)
}
} else {
size_t e = song.CountMeasures() - song.EmptyEnding();
if (!e && song.CountMeasures())
e = 1;
for (size_t m=0; m!=e; ++m) {
VLMeasure & meas = song.fMeasures[m];

View File

@ -491,6 +491,11 @@ advanceAt:
[self readMeasuresFromPlist:[plist objectForKey:@"measures"]];
[undoMgr enableUndoRegistration];
if (song->fMeasures.empty()) {
delete song;
song = new VLSong(true);
}
return YES;
}