From ea3c386aa2725f0794fb29546f342196e3ceea52 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Mon, 28 May 2007 11:24:37 +0000 Subject: [PATCH] Fix #418 (crash modifying karaoke timing on lines with text before first karaoke tag.) Originally committed to SVN as r1198. --- aegisub/audio_karaoke.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aegisub/audio_karaoke.cpp b/aegisub/audio_karaoke.cpp index 737caa3e0..d55d9e3d1 100644 --- a/aegisub/audio_karaoke.cpp +++ b/aegisub/audio_karaoke.cpp @@ -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();