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:
parent
fcba0c8e2a
commit
7d2c7c5881
2 changed files with 3 additions and 7 deletions
|
@ -279,6 +279,8 @@ bool AssFile::CanSave() {
|
||||||
// I strongly advice you against touching this function unless you know what you're doing;
|
// 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.
|
// even moving things out of order might break ASS parsing - AMZ.
|
||||||
void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGroup) {
|
void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGroup) {
|
||||||
|
if (data.empty()) return;
|
||||||
|
|
||||||
// Group
|
// Group
|
||||||
AssEntry *entry = NULL;
|
AssEntry *entry = NULL;
|
||||||
wxString origGroup = group;
|
wxString origGroup = group;
|
||||||
|
@ -344,7 +346,7 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dialogue
|
// Dialogue
|
||||||
if (lowGroup == _T("[events]")) {
|
else if (lowGroup == _T("[events]")) {
|
||||||
if (data.StartsWith(_T("Dialogue:")) || data.StartsWith(_T("Comment:"))) {
|
if (data.StartsWith(_T("Dialogue:")) || data.StartsWith(_T("Comment:"))) {
|
||||||
AssDialogue *diag = new AssDialogue(data,version);
|
AssDialogue *diag = new AssDialogue(data,version);
|
||||||
//diag->ParseASSTags();
|
//diag->ParseASSTags();
|
||||||
|
|
|
@ -136,9 +136,6 @@ void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
|
||||||
// Not-so-special case for other groups, just set it
|
// Not-so-special case for other groups, just set it
|
||||||
else {
|
else {
|
||||||
curgroup = wxbuffer;
|
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;
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue