From c119d2d84b077e704ed12aae382da139dbc6b47d Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 18 Nov 2011 04:04:35 +0000 Subject: [PATCH] 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. --- aegisub/src/subs_edit_box.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aegisub/src/subs_edit_box.cpp b/aegisub/src/subs_edit_box.cpp index fabc1dd9d..b6e3c1653 100644 --- a/aegisub/src/subs_edit_box.cpp +++ b/aegisub/src/subs_edit_box.cpp @@ -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);