Commit 7035ddf6 authored by Zhuoyu Qian's avatar Zhuoyu Qian Committed by Commit Bot

Check all usage of |factory| in RegisterSchemeFactory().

The parameter |factory| of HttpAuthHandlerRegistryFactory::
RegisterSchemeFactory() maybe nullptr, move all usage of |factory|
in the check, make sure it will not crash.

Change-Id: Ic48b8e798bf26229436ccd2357a5c1a0dec789d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2333912Reviewed-by: default avatarZhongyi Shi <zhongyi@chromium.org>
Commit-Queue: Zhongyi Shi <zhongyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794893}
parent 26e8d8a4
...@@ -84,12 +84,13 @@ void HttpAuthHandlerRegistryFactory::SetHttpAuthPreferences( ...@@ -84,12 +84,13 @@ void HttpAuthHandlerRegistryFactory::SetHttpAuthPreferences(
void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory( void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory(
const std::string& scheme, const std::string& scheme,
HttpAuthHandlerFactory* factory) { HttpAuthHandlerFactory* factory) {
factory->set_http_auth_preferences(http_auth_preferences());
std::string lower_scheme = base::ToLowerASCII(scheme); std::string lower_scheme = base::ToLowerASCII(scheme);
if (factory) if (factory) {
factory->set_http_auth_preferences(http_auth_preferences());
factory_map_[lower_scheme] = base::WrapUnique(factory); factory_map_[lower_scheme] = base::WrapUnique(factory);
else } else {
factory_map_.erase(lower_scheme); factory_map_.erase(lower_scheme);
}
} }
HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory( HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment