Skip to content

Commit

Permalink
Minor cleanup in SoundManager
Browse files Browse the repository at this point in the history
SVN-Revision: 6539
  • Loading branch information
Mathnerd314 committed Mar 4, 2010
1 parent 8d51832 commit 6bd1589
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/audio/sound_manager.cpp
Expand Up @@ -54,12 +54,14 @@ SoundManager::SoundManager() :
sound_enabled = true;
music_enabled = true;
} catch(std::exception& e) {
if(context != NULL)
if(context != NULL) {
alcDestroyContext(context);
context = NULL;
if(device != NULL)
context = NULL;
}
if(device != NULL) {
alcCloseDevice(device);
device = NULL;
device = NULL;
}
log_warning << "Couldn't initialize audio device: " << e.what() << std::endl;
print_openal_version();
}
Expand All @@ -80,9 +82,11 @@ SoundManager::~SoundManager()

if(context != NULL) {
alcDestroyContext(context);
context = NULL;
}
if(device != NULL) {
alcCloseDevice(device);
device = NULL;
}
}

Expand Down Expand Up @@ -254,7 +258,7 @@ SoundManager::enable_music(bool enable)
} else {
if(music_source) {
delete music_source;
music_source = 0;
music_source = NULL;
}
}
}
Expand Down

0 comments on commit 6bd1589

Please sign in to comment.