diff --git a/src/core/loader.cpp b/src/core/loader.cpp --- a/src/core/loader.cpp +++ b/src/core/loader.cpp @@ -89,13 +89,16 @@ if (plang.isEmpty()) { plang = d->settings->defaultLanguage(); } - const QVector lClients = d->languageClients[plang]; - if (lClients.isEmpty()) { + auto clientsItr = d->languageClients.constFind(plang); + if (clientsItr == d->languageClients.constEnd()) { qCWarning(SONNET_LOG_CORE) << "No language dictionaries for the language:" << plang; + emit loadingDictionaryFailed(plang); return nullptr; } + const QVector lClients = *clientsItr; + if (backend.isEmpty()) { backend = d->settings->defaultClient(); if (!backend.isEmpty()) { diff --git a/src/core/loader_p.h b/src/core/loader_p.h --- a/src/core/loader_p.h +++ b/src/core/loader_p.h @@ -127,6 +127,15 @@ */ void configurationChanged(); + /** + * Emitted when loading a dictionary fails, so that Ui parts can + * display an appropriate error message informing the user about + * the issue. + * @param lang the name of the dictionary that failed to be loaded + * @since 5.56 + */ + void loadingDictionaryFailed(const QString &lang) const; + protected: friend class Settings; void changed();