properly detect missing subtitle provider

Originally committed to SVN as r376.
This commit is contained in:
David Lamparter 2006-05-06 16:21:03 +00:00
parent a850859d08
commit 04e8ef1cd9
2 changed files with 12 additions and 2 deletions

View File

@ -50,6 +50,12 @@ SubtitleProvider::Class::Class(wxString name)
SubtitleProvider *SubtitleProvider::Class::GetProvider(wxString provider_name, AssFile *subs)
{
return (*classes)[provider_name]->Get(subs);
SubtitleProvider::Class *sp;
if (!classes)
throw _T("Subtitle provider not found");
sp = (*classes)[provider_name];
if (!sp)
throw _T("Subtitle provider not found");
return sp->Get(subs);
}

View File

@ -72,7 +72,11 @@ LAVCVideoProvider::LAVCVideoProvider(wxString filename, wxString subfilename) {
LoadVideo(filename);
// Attach subtitles
SubtitleProvider::Class::GetProvider(_T("asa"), AssFile::top)->Bind(this);
try {
SubtitleProvider::Class::GetProvider(_T("asa"), AssFile::top)->Bind(this);
} catch (...) {
/* warn user? */
}
}