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:
parent
4e57f0236b
commit
e893e3af31
@ -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
|
||||
{
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user