mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Win-specific: Fix crash if TTS interface is not presented in system
This commit is contained in:
parent
3bd078debb
commit
b100fad8d3
|
@ -81,7 +81,7 @@ bool speechAvailable(SpeechHelper sp)
|
|||
void speechEnumerateAvailableEngines(EnumerateCallback callback, void *userData)
|
||||
{
|
||||
HRESULT hr;
|
||||
IEnumSpObjectTokens * enumSpTokens;
|
||||
IEnumSpObjectTokens * enumSpTokens = NULL;
|
||||
ULONG count = 0;
|
||||
bool next = true;
|
||||
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
||||
|
|
14
sphelper.hh
14
sphelper.hh
|
@ -20,7 +20,7 @@
|
|||
#ifdef _SAPI_VER
|
||||
#undef _SAPI_VER
|
||||
#endif
|
||||
#define _SAPI_VER 0503
|
||||
#define _SAPI_VER 0x053
|
||||
|
||||
inline void SpHexFromUlong(WCHAR * psz, ULONG ul)
|
||||
{
|
||||
|
@ -110,6 +110,12 @@ inline HRESULT SpGetDescription(ISpObjectToken * pObjToken, WCHAR ** ppszDescrip
|
|||
WCHAR szLangId[10];
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (ppszDescription == NULL)
|
||||
{
|
||||
return E_POINTER;
|
||||
}
|
||||
*ppszDescription = NULL;
|
||||
|
||||
#if _SAPI_VER >= 0x053
|
||||
WCHAR* pRegKeyPath = 0;
|
||||
WCHAR* pszTemp = 0;
|
||||
|
@ -120,12 +126,6 @@ inline HRESULT SpGetDescription(ISpObjectToken * pObjToken, WCHAR ** ppszDescrip
|
|||
OSVERSIONINFO ver;
|
||||
ver.dwOSVersionInfoSize = sizeof( ver );
|
||||
|
||||
if (ppszDescription == NULL)
|
||||
{
|
||||
return E_POINTER;
|
||||
}
|
||||
*ppszDescription = NULL;
|
||||
|
||||
if( ( ::GetVersionEx( &ver ) == TRUE ) && ( ver.dwMajorVersion >= 6 ) )
|
||||
{
|
||||
// If we reach this code we are running under Windows Vista
|
||||
|
|
Loading…
Reference in a new issue