Check the return value of IDirectSoundImpl_Create() to detect errors.

Always set *ppDS to NULL in case of error.
This commit is contained in:
Francois Gouget 2004-08-02 18:27:16 +00:00 committed by Alexandre Julliard
parent 0bbe91213d
commit 1426632839
1 changed files with 3 additions and 2 deletions

View File

@ -757,6 +757,7 @@ HRESULT WINAPI IDirectSoundImpl_Create(
if (found == FALSE) {
WARN("No device found matching given ID!\n");
*ppDS = NULL;
return DSERR_NODRIVER;
}
@ -1641,7 +1642,7 @@ HRESULT WINAPI DSOUND_Create(
} else {
LPDIRECTSOUND8 pDS;
hr = IDirectSoundImpl_Create(&devGuid, &pDS);
if (pDS) {
if (hr == DS_OK) {
hr = DSOUND_PrimaryCreate((IDirectSoundImpl*)pDS);
if (hr == DS_OK) {
hr = IDirectSound_IDirectSound_Create(pDS, ppDS);
@ -1746,7 +1747,7 @@ HRESULT WINAPI DSOUND_Create8(
} else {
LPDIRECTSOUND8 pDS;
hr = IDirectSoundImpl_Create(&devGuid, &pDS);
if (pDS) {
if (hr == DS_OK) {
hr = DSOUND_PrimaryCreate((IDirectSoundImpl*)pDS);
if (hr == DS_OK) {
hr = IDirectSound8_IDirectSound8_Create(pDS, ppDS);