SYNERGY-1307 Prevent notifications if language reading fails (#7115)

* SYNERGY-1307 Prevent notifications if language reading fails

* Update ChangeLog

* SYNERGY-1307 Fix code smell
This commit is contained in:
Serhii Hadzhilov 2021-11-04 17:48:23 +02:00 committed by GitHub
parent 4a30a9234b
commit 5c7db2788d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View file

@ -18,6 +18,7 @@ Bug fixes:
- #7097 The title "Enterprise" disappeares after clicking on "Preferences" - #7097 The title "Enterprise" disappeares after clicking on "Preferences"
- #7108 Wrong characters on client for unicode - #7108 Wrong characters on client for unicode
- #7114 Fixed problem with reading languages on Linux system - #7114 Fixed problem with reading languages on Linux system
- #7115 Prevent notifications if language reading fails
Enhancements: Enhancements:
- #7068 Add Synergy restart when settings changed - #7068 Add Synergy restart when settings changed

View file

@ -35,6 +35,7 @@
#include <memory> #include <memory>
#include <algorithm> #include <algorithm>
#include <cstring>
// //
// ServerProxy // ServerProxy
@ -967,7 +968,7 @@ ServerProxy::setServerLanguages()
void void
ServerProxy::setActiveServerLanguage(const String& language) ServerProxy::setActiveServerLanguage(const String& language)
{ {
if (!language.empty()) { if (!language.empty() && std::strlen(language.c_str()) > 0) {
if(m_serverLanguage != language) { if(m_serverLanguage != language) {
m_isUserNotifiedAboutLanguageSyncError = false; m_isUserNotifiedAboutLanguageSyncError = false;
m_serverLanguage = language; m_serverLanguage = language;

View file

@ -89,7 +89,13 @@ String LanguageManager::getSerializedLocalLanguages() const
bool LanguageManager::isLanguageInstalled(const String& language) const bool LanguageManager::isLanguageInstalled(const String& language) const
{ {
return (std::find(m_localLanguages.begin(), m_localLanguages.end(), language) != m_localLanguages.end()); bool isInstalled = true;
if (!m_localLanguages.empty()) {
isInstalled = (std::find(m_localLanguages.begin(), m_localLanguages.end(), language) != m_localLanguages.end());
}
return isInstalled;
} }
} //namespace languages } //namespace languages