Applied 2points's patch to work around a crash in ass and libass when there are no styles in the file.
Originally committed to SVN as r1629.
This commit is contained in:
parent
b706e3c7b7
commit
97a14933a4
1 changed files with 6 additions and 1 deletions
|
@ -187,6 +187,11 @@ void AssFile::SaveMemory(std::vector<char> &dst,const wxString encoding) {
|
|||
if (enc.IsEmpty()) enc = _T("UTF-8");
|
||||
if (enc != _T("UTF-8")) throw _T("Memory writer only supports UTF-8 for now.");
|
||||
|
||||
// Check if subs contain at least one style
|
||||
// Add a default style if they don't for compatibility with libass/asa
|
||||
if (GetStyles().Count() == 0)
|
||||
InsertStyle(new AssStyle());
|
||||
|
||||
// Prepare vector
|
||||
dst.clear();
|
||||
dst.reserve(0x4000);
|
||||
|
@ -805,7 +810,6 @@ wxArrayString AssFile::GetStyles() {
|
|||
styles.Add(curstyle->name);
|
||||
}
|
||||
}
|
||||
if (styles.GetCount() == 0) styles.Add(_T("Default"));
|
||||
return styles;
|
||||
}
|
||||
|
||||
|
@ -1033,3 +1037,4 @@ bool AssFile::StackModified;
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue