Fixes a crash when a file cannot be loaded, and fixes music not stopping when ogg starts.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1187 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
coz 2007-07-24 06:46:00 +00:00
parent 4e57f0236b
commit e893e3af31
2 changed files with 8 additions and 1 deletions

View File

@ -29,6 +29,7 @@
#include "music_ogg.hpp"
#include "loader.hpp"
#include "user_config.hpp"
#define BUFFER_SIZE (4096 * 8)
@ -51,7 +52,12 @@ MusicOggStream::~MusicOggStream()
//-----------------------------------------------------------------------------
bool MusicOggStream::load(const char* filename)
{
//assert(release());
if(!release())
{
user_config->setMusic(UserConfig::UC_TEMPORARY_DISABLE);
fprintf(stderr,"Problems oggStream:release. Disabling music.\n");
return false;
}
try
{

View File

@ -158,6 +158,7 @@ void SoundManager::playMusic(const char* filename)
if (m_current_music != NULL)
{
delete m_current_music;
m_current_music = NULL;
}
if (filename == NULL || strlen(filename) == 0)