Added more null check when checking NTP search conversion

https://github.com/brave/brave-browser/issues/25849
This commit is contained in:
Simon Hong
2022-10-07 09:07:50 +09:00
parent c377d38b3b
commit ae470a75ee
+5 -1
View File
@@ -33,7 +33,11 @@ bool IsNTPPromotionEnabled(PrefService* prefs, TemplateURLService* service) {
// Don't need to prompt for conversion if user uses brave as a default
// provider.
auto id = service->GetDefaultSearchProvider()->data().prepopulate_id;
auto* template_url = service->GetDefaultSearchProvider();
if (!template_url)
return false;
const auto id = template_url->prepopulate_id();
if (id == TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_BRAVE ||
id == TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_BRAVE_TOR) {
return false;