Fix crash when trying to open audio from file with no audio tracks

Originally committed to SVN as r5682.
This commit is contained in:
Thomas Goyne 2011-09-29 20:27:13 +00:00
parent 7b1dea1a7a
commit 32463efb08
2 changed files with 21 additions and 11 deletions

View File

@ -122,7 +122,7 @@ AudioProvider *AudioProviderFactory::GetProvider(wxString filename, int cache) {
}
catch (AudioOpenError const& err) {
found = true;
msg += err.GetMessage();
msg += err.GetMessage() + "\n";
}
}
if (!provider) {
@ -139,7 +139,7 @@ AudioProvider *AudioProviderFactory::GetProvider(wxString filename, int cache) {
}
catch (AudioOpenError const& err) {
found = true;
msg += list[i] + ": " + err.GetMessage();
msg += list[i] + ": " + err.GetMessage() + "\n";
}
}
}

View File

@ -89,6 +89,7 @@ struct audio_open : public Command {
STR_HELP("Opens an audio file.")
void operator()(agi::Context *c) {
try {
wxString path = lagi_wxString(OPT_GET("Path/Last/Audio")->GetString());
wxString str = wxString(_("Audio Formats")) + " (*.wav,*.mp3,*.ogg,*.flac,*.mp4,*.ac3,*.aac,*.mka,*.m4a,*.w64)|*.wav;*.mp3;*.ogg;*.flac;*.mp4;*.ac3;*.aac;*.mka;*.m4a;*.w64|"
+ _("Video Formats") + " (*.avi,*.mkv,*.ogm,*.mpg,*.mpeg)|*.avi;*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg|"
@ -99,6 +100,10 @@ struct audio_open : public Command {
OPT_SET("Path/Last/Audio")->SetString(STD_STR(filename));
}
}
catch (agi::Exception const& e) {
wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxICON_ERROR | wxOK);
}
}
};
@ -141,8 +146,13 @@ struct audio_open_video : public Command {
}
void operator()(agi::Context *c) {
try {
c->audioController->OpenAudio(c->videoController->videoName);
}
catch (agi::Exception const& e) {
wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxICON_ERROR | wxOK);
}
}
};