Fix potential crash when deleting lines with audio open

Don't assume that the active line is valid in RegenerateInactiveLines,
as it may get called by the commit signal before the selection is
updated when the active line is deleted.

Closes #1502.

Originally committed to SVN as r6932.
This commit is contained in:
Thomas Goyne 2012-07-08 23:22:27 +00:00
parent 5162c28684
commit 60c38bd2e5

View file

@ -736,6 +736,8 @@ void AudioTimingControllerDialogue::RegenerateInactiveLines()
{ {
std::list<AssEntry*>::iterator current_line = std::list<AssEntry*>::iterator current_line =
find(context->ass->Line.begin(), context->ass->Line.end(), line); find(context->ass->Line.begin(), context->ass->Line.end(), line);
if (current_line == context->ass->Line.end())
break;
std::list<AssEntry*>::iterator prev = current_line; std::list<AssEntry*>::iterator prev = current_line;
while (--prev != context->ass->Line.begin() && !predicate(*prev)) ; while (--prev != context->ass->Line.begin() && !predicate(*prev)) ;