fix crash if RageSoundManager or SongManager throw

This commit is contained in:
Glenn Maynard
2003-02-16 05:10:08 +00:00
parent 3f9504b7b9
commit 3b8d26e564
2 changed files with 25 additions and 13 deletions
+12 -5
View File
@@ -20,13 +20,20 @@ RageSoundManager::RageSoundManager(CString drivers)
{
/* needs to be done first */
SOUNDMAN = this;
MixVolume = 1.0f;
driver = MakeRageSoundDriver(drivers);
if(!driver)
RageException::Throw("Couldn't find a sound driver that works");
try
{
MixVolume = 1.0f;
music = new RageSound;
driver = MakeRageSoundDriver(drivers);
if(!driver)
RageException::Throw("Couldn't find a sound driver that works");
music = new RageSound;
} catch(...) {
SOUNDMAN = NULL;
throw;
}
}
RageSoundManager::~RageSoundManager()
+13 -8
View File
@@ -51,16 +51,21 @@ SongManager::SongManager( LoadingWindow *ld )
/* We initialize things that assume they can get at SONGMAN; we only
* init one of these, so hook us up to it immediately. */
SONGMAN = this;
try
{
g_vGroupColors.clear();
for( int i=0; i<NUM_GROUP_COLORS; i++ )
g_vGroupColors.push_back( GROUP_COLOR(i) );
g_ExtraColor = EXTRA_COLOR;
g_vGroupColors.clear();
for( int i=0; i<NUM_GROUP_COLORS; i++ )
g_vGroupColors.push_back( GROUP_COLOR(i) );
g_ExtraColor = EXTRA_COLOR;
InitSongArrayFromDisk( ld );
InitMachineScoresFromDisk();
InitSongArrayFromDisk( ld );
InitMachineScoresFromDisk();
InitCoursesFromDisk();
InitCoursesFromDisk();
} catch(...) {
SONGMAN = NULL;
throw;
}
}
SongManager::~SongManager()