don't crash if no primary backends are avalible
This commit is contained in:
parent
737e289167
commit
d795a81a1d
|
@ -146,12 +146,18 @@ void SnoreCorePrivate::init()
|
||||||
void SnoreCorePrivate::syncSettings()
|
void SnoreCorePrivate::syncSettings()
|
||||||
{
|
{
|
||||||
Q_Q(SnoreCore);
|
Q_Q(SnoreCore);
|
||||||
QString oldBackend = q->primaryNotificationBackend();
|
QString newBackend = q->value("PrimaryBackend", LOCAL_SETTING);
|
||||||
m_notificationBackend->deinitialize();
|
if (newBackend) {
|
||||||
m_notificationBackend = nullptr;
|
QString oldBackend;
|
||||||
if (!setBackendIfAvailible(q->value("PrimaryBackend", LOCAL_SETTING).toString())) {
|
if (m_notificationBackend) {
|
||||||
snoreDebug(SNORE_WARNING) << "Failed to set new backend" << q->value("PrimaryBackend", LOCAL_SETTING).toString() << "restoring" << oldBackend;
|
oldBackend = m_notificationBackend->name();
|
||||||
setBackendIfAvailible(oldBackend);
|
m_notificationBackend->deinitialize();
|
||||||
|
m_notificationBackend = nullptr;
|
||||||
|
}
|
||||||
|
if (!setBackendIfAvailible(newBackend)) {
|
||||||
|
snoreDebug(SNORE_WARNING) << "Failed to set new backend" << q->value("PrimaryBackend", LOCAL_SETTING).toString() << "restoring" << oldBackend;
|
||||||
|
setBackendIfAvailible(oldBackend);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//TODO: cleanup
|
//TODO: cleanup
|
||||||
auto syncPluginStatus = [&](const QString & pluginName) {
|
auto syncPluginStatus = [&](const QString & pluginName) {
|
||||||
|
|
Loading…
Reference in New Issue