Fixed error handling in case of non-existent ogg files (r1148 on 0.3rc1 branch).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1149 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
2ef1d70096
commit
8e930e0ee6
@ -19,6 +19,7 @@
|
||||
|
||||
#if HAVE_OPENAL && HAVE_OGGVORBIS
|
||||
|
||||
#include <stdexcept>
|
||||
#ifdef __APPLE__
|
||||
# include <OpenAL/al.h>
|
||||
#else
|
||||
@ -52,7 +53,14 @@ bool MusicOggStream::load(const char* filename)
|
||||
{
|
||||
//assert(release());
|
||||
|
||||
m_fileName = loader->getPath(filename);
|
||||
try
|
||||
{
|
||||
m_fileName = loader->getPath(filename);
|
||||
}
|
||||
catch(std::runtime_error)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
oggFile = fopen(m_fileName.c_str(), "rb");
|
||||
|
||||
if (ov_open(oggFile, &m_oggStream, NULL, 0) < 0)
|
||||
|
@ -185,7 +185,8 @@ void SoundManager::playMusic(const char* filename)
|
||||
if((m_current_music->load(filename)) == false)
|
||||
{
|
||||
delete m_current_music;
|
||||
fprintf(stderr, "WARNING: Unabled to load music %s, not supported\n", filename);
|
||||
m_current_music=0;
|
||||
fprintf(stderr, "WARNING: Unabled to load music %s, not supported or not found.\n", filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user