Fix dashboard crash with empty configuration
This commit is contained in:
@@ -129,12 +129,15 @@ void Settings::load(const wivrn_server * server)
|
|||||||
{
|
{
|
||||||
auto conf = server->jsonConfiguration();
|
auto conf = server->jsonConfiguration();
|
||||||
m_jsonSettings = nlohmann::json::parse(conf.toUtf8());
|
m_jsonSettings = nlohmann::json::parse(conf.toUtf8());
|
||||||
|
if (not m_jsonSettings.is_object())
|
||||||
|
m_jsonSettings = nlohmann::json::object();
|
||||||
emitAllChanged();
|
emitAllChanged();
|
||||||
}
|
}
|
||||||
catch (std::exception & e)
|
catch (std::exception & e)
|
||||||
{
|
{
|
||||||
qWarning() << "Cannot read configuration: " << e.what();
|
qWarning() << "Cannot read configuration: " << e.what();
|
||||||
restore_defaults();
|
m_jsonSettings = nlohmann::json::object();
|
||||||
|
emitAllChanged();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user