Don't add garbage AssEntries for blank lines in the file. Fixes some issues with sorting lines.

Originally committed to SVN as r4801.
This commit is contained in:
Thomas Goyne 2010-10-11 20:06:04 +00:00
parent fcba0c8e2a
commit 7d2c7c5881
2 changed files with 3 additions and 7 deletions

View File

@ -279,6 +279,8 @@ bool AssFile::CanSave() {
// I strongly advice you against touching this function unless you know what you're doing;
// even moving things out of order might break ASS parsing - AMZ.
void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGroup) {
if (data.empty()) return;
// Group
AssEntry *entry = NULL;
wxString origGroup = group;
@ -344,7 +346,7 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro
}
// Dialogue
if (lowGroup == _T("[events]")) {
else if (lowGroup == _T("[events]")) {
if (data.StartsWith(_T("Dialogue:")) || data.StartsWith(_T("Comment:"))) {
AssDialogue *diag = new AssDialogue(data,version);
//diag->ParseASSTags();

View File

@ -136,9 +136,6 @@ void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
// Not-so-special case for other groups, just set it
else {
curgroup = wxbuffer;
// default from extension in all other sections
//version = 1;
//if (filename.Right(4).Lower() == _T(".ssa")) version = 0;
}
}
@ -155,9 +152,6 @@ void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
throw wxString(_T("Error processing line: ")) + wxbuffer;
}
}
// Add one last empty line in case it didn't end with one
if (!wxbuffer.IsEmpty()) AddLine(_T(""),curgroup,version);
}