mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 21:41:51 +02:00
Check key existance before getting it from JSON (#1632)
This commit is contained in:
@@ -207,6 +207,8 @@ void start_initial_powertoys()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
general_settings = load_general_settings();
|
general_settings = load_general_settings();
|
||||||
|
if (general_settings.HasKey(L"enabled"))
|
||||||
|
{
|
||||||
json::JsonObject enabled = general_settings.GetNamedObject(L"enabled");
|
json::JsonObject enabled = general_settings.GetNamedObject(L"enabled");
|
||||||
for (const auto& enabled_element : enabled)
|
for (const auto& enabled_element : enabled)
|
||||||
{
|
{
|
||||||
@@ -218,11 +220,9 @@ void start_initial_powertoys()
|
|||||||
}
|
}
|
||||||
only_enable_some_powertoys = true;
|
only_enable_some_powertoys = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
// Couldn't read the general settings correctly.
|
|
||||||
// Load all powertoys.
|
|
||||||
// TODO: notify user about invalid json config
|
|
||||||
only_enable_some_powertoys = false;
|
only_enable_some_powertoys = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user