rbutilqt: Add error handling to TTSCarbon::generateSettings()
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Mon, 29 Jun 2026 21:16:25 -0400
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 1039eb305a85efc897dd0d11d6b2b4ba5c7de23b Author: Vencislav Atanasov <[email protected]> Date: Mon Jun 29 22:28:35 2026 +0300 rbutilqt: Add error handling to TTSCarbon::generateSettings() Co-authored-by: ChatGPT (GPT-5.3 Mini) <[email protected]> Change-Id: Iad04028853e930b508e72c2c9c3e9ebd9504d4bb diff --git a/utils/rbutilqt/base/ttscarbon.cpp b/utils/rbutilqt/base/ttscarbon.cpp index 2425c0fe3d..95cfeb3338 100644 --- a/utils/rbutilqt/base/ttscarbon.cpp +++ b/utils/rbutilqt/base/ttscarbon.cpp @@ -117,18 +117,33 @@ void TTSCarbon::generateSettings(void) // get system voice error = GetVoiceDescription(NULL, &vdesc, sizeof(vdesc)); + if (error != 0) { + LOG_ERROR() << "GetVoiceDescription() failed with code" << error; + return; + } systemVoice = QString::fromLocal8Bit((const char*)&vdesc.name[1], vdesc.name[0]); // get list of all voices CountVoices(&numVoices); for(SInt16 i = 1; i < numVoices; ++i) { error = GetIndVoice(i, &vspec); + if (error != 0) { + LOG_ERROR() << "GetIndVoice(" << i << ") failed with code" << error; + continue; + } error = GetVoiceDescription(&vspec, &vdesc, sizeof(vdesc)); + if (error != 0) { + LOG_ERROR() << "GetVoiceDescription(" << i << ") failed with code" << error; + continue; + } // name is pascal string, i.e. the first byte is the length. QString name = QString::fromLocal8Bit((const char*)&vdesc.name[1], vdesc.name[0]); voiceNames.append(name.trimmed()); } + if (voiceNames.isEmpty()) { + return; + } // voice EncTtsSetting* setting; QString voice -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs