Chromium Code Reviews| Index: chrome/browser/policy/configuration_policy_handler.cc |
| diff --git a/chrome/browser/policy/configuration_policy_handler.cc b/chrome/browser/policy/configuration_policy_handler.cc |
| index be6524f238f969ce41987b01f376f44bbc03f70b..032e3a4b6ab30693f4c0d1266ae8b3799210da2b 100644 |
| --- a/chrome/browser/policy/configuration_policy_handler.cc |
| +++ b/chrome/browser/policy/configuration_policy_handler.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/policy/configuration_policy_handler.h" |
| #include <algorithm> |
| +#include <cstring> |
| #include <string> |
| #include "base/files/file_path.h" |
| @@ -292,6 +293,8 @@ bool StringToIntEnumListPolicyHandler::CheckPolicySettings( |
| void StringToIntEnumListPolicyHandler::ApplyPolicySettings( |
| const PolicyMap& policies, |
| PrefValueMap* prefs) { |
| + if (!strlen(pref_path_)) |
|
Mattias Nissler (ping if slow)
2013/06/12 13:55:16
Why not test for NULL?
bartfab (slow)
2013/06/12 18:57:49
Done.
|
| + return; |
| const base::Value* value = policies.GetValue(policy_name()); |
| scoped_ptr<base::ListValue> list(new base::ListValue()); |
| if (value && Convert(value, list.get(), NULL)) |
| @@ -360,6 +363,8 @@ IntRangePolicyHandler::~IntRangePolicyHandler() { |
| void IntRangePolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| PrefValueMap* prefs) { |
| + if (!strlen(pref_path_)) |
| + return; |
| const base::Value* value = policies.GetValue(policy_name()); |
| int value_in_range; |
| if (value && EnsureInRange(value, &value_in_range, NULL)) { |
| @@ -386,6 +391,8 @@ IntPercentageToDoublePolicyHandler::~IntPercentageToDoublePolicyHandler() { |
| void IntPercentageToDoublePolicyHandler::ApplyPolicySettings( |
| const PolicyMap& policies, |
| PrefValueMap* prefs) { |
| + if (!strlen(pref_path_)) |
| + return; |
| const base::Value* value = policies.GetValue(policy_name()); |
| int percentage; |
| if (value && EnsureInRange(value, &percentage, NULL)) { |
| @@ -616,6 +623,8 @@ bool ExtensionURLPatternListPolicyHandler::CheckPolicySettings( |
| void ExtensionURLPatternListPolicyHandler::ApplyPolicySettings( |
| const PolicyMap& policies, |
| PrefValueMap* prefs) { |
| + if (!strlen(pref_path_)) |
| + return; |
| const Value* value = policies.GetValue(policy_name()); |
| if (value) |
| prefs->SetValue(pref_path_, value->DeepCopy()); |
| @@ -636,6 +645,8 @@ SimplePolicyHandler::~SimplePolicyHandler() { |
| void SimplePolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| PrefValueMap* prefs) { |
| + if (!strlen(pref_path_)) |
| + return; |
| const Value* value = policies.GetValue(policy_name()); |
| if (value) |
| prefs->SetValue(pref_path_, value->DeepCopy()); |