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