Handle ASS files with missing [Script Info] header better, updates #440.
This should get some additional regression testing before the bug is closed and the fix backported to 2.1.8. Originally committed to SVN as r3308.
This commit is contained in:
parent
174c17309b
commit
3097ca162d
1 changed files with 7 additions and 0 deletions
|
@ -96,6 +96,13 @@ void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
|
|||
// Reads line
|
||||
wxbuffer = file.ReadLineFromFile();
|
||||
|
||||
// Make sure that the first non-blank non-comment non-group-header line
|
||||
// is really [Script Info]
|
||||
if (curgroup.IsEmpty() && !wxbuffer.IsEmpty() && wxbuffer[0] != _T(';') && wxbuffer[0] != _T('[')) {
|
||||
curgroup = _T("[Script Info]");
|
||||
lasttime = AddLine(curgroup,curgroup,lasttime,version,&curgroup);
|
||||
}
|
||||
|
||||
// Convert v4 styles to v4+ styles
|
||||
if (!wxbuffer.IsEmpty() && wxbuffer[0] == _T('[')) {
|
||||
// Ugly hacks to allow intermixed v4 and v4+ style sections
|
||||
|
|
Loading…
Reference in a new issue