Don't try to use the active line in a handler for COMMIT_NEW as it may not be valid

Originally committed to SVN as r5874.
This commit is contained in:
Thomas Goyne 2011-11-18 04:04:35 +00:00
parent 28c7e7dec3
commit c119d2d84b

View file

@ -340,7 +340,6 @@ void SubsEditBox::Update(int type) {
if (type == AssFile::COMMIT_NEW || type & AssFile::COMMIT_STYLES) {
StyleBox->Clear();
StyleBox->Append(c->ass->GetStyles());
StyleBox->Select(StyleBox->FindString(line->Style));
}
if (type == AssFile::COMMIT_NEW) {
@ -351,6 +350,9 @@ void SubsEditBox::Update(int type) {
SetEvtHandlerEnabled(true);
return;
}
else if (type & AssFile::COMMIT_STYLES)
StyleBox->Select(StyleBox->FindString(line->Style));
if (!(type ^ AssFile::COMMIT_ORDER)) return;
SetControlsState(!!line);