mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
SAPI - Improve the error logic in Get/SetObjectToken.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <sapiddk.h>
|
||||
#include <sperror.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
@@ -109,18 +110,24 @@ HRESULT __stdcall TtsEngine::GetObjectToken(ISpObjectToken **token)
|
||||
return E_POINTER;
|
||||
|
||||
*token = objectToken;
|
||||
if (objectToken)
|
||||
if (objectToken) {
|
||||
objectToken->AddRef();
|
||||
return S_OK;
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
HRESULT __stdcall TtsEngine::SetObjectToken(ISpObjectToken *token)
|
||||
{
|
||||
if (!token)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (objectToken)
|
||||
objectToken->Release();
|
||||
return SPERR_ALREADY_INITIALIZED;
|
||||
|
||||
objectToken = token;
|
||||
if (objectToken)
|
||||
objectToken->AddRef();
|
||||
objectToken->AddRef();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user