Fix #418 (crash modifying karaoke timing on lines with text before first karaoke tag.)

Originally committed to SVN as r1198.
This commit is contained in:
Niels Martin Hansen 2007-05-28 11:24:37 +00:00
parent 6a9e0d8d68
commit ea3c386aa2
1 changed files with 6 additions and 1 deletions

View File

@ -164,7 +164,12 @@ void AudioKaraoke::Commit() {
wxLogDebug(_T("Updating syllable %d"), i);
syl = &syllables.at(i);
wxLogDebug(_T("Syllable pointer: %p; tagdata pointer: %p; length: %d"), syl, syl->original_tagdata, syl->length);
syl->original_tagdata->SetInt(syl->length);
// Some weird people have text before the first karaoke tag on a line.
// Check that a karaoke tag actually exists for the (non-)syllable to avoid a crash.
if (syl->original_tagdata)
syl->original_tagdata->SetInt(syl->length);
// Of course, if the user changed the duration of such a non-syllable, its timing can't be updated and will stay zero.
// There is no way to check for that right now, and I can't bother to fix it.
}
wxLogDebug(_T("Done updating syllables"));
workDiag->UpdateText();