fix crash if DirectSoundCreate fails (eg. no sound devices)

This commit is contained in:
Glenn Maynard
2005-10-22 03:10:53 +00:00
parent 59fb0dbe41
commit 3044155ce8
@@ -103,6 +103,7 @@ DSound::DSound()
HRESULT hr; HRESULT hr;
if( FAILED( hr = CoInitialize(NULL) ) ) if( FAILED( hr = CoInitialize(NULL) ) )
RageException::Throw( hr_ssprintf(hr, "CoInitialize") ); RageException::Throw( hr_ssprintf(hr, "CoInitialize") );
m_pDS = NULL;
} }
CString DSound::Init() CString DSound::Init()
@@ -143,6 +144,7 @@ CString DSound::Init()
DSound::~DSound() DSound::~DSound()
{ {
if( m_pDS != NULL )
m_pDS->Release(); m_pDS->Release();
CoUninitialize(); CoUninitialize();
} }