Skip to content

Commit

Permalink
ensure that browser is never null
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed Feb 4, 2019
1 parent 2191853 commit 4f060a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/brave_ads/browser/ads_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,10 @@ void AdsServiceImpl::OpenSettings(Profile* profile,
#if defined(OS_ANDROID)
NavigateParams nav_params(profile, url, ui::PAGE_TRANSITION_LINK);
#else
Browser* browser = chrome::FindLastActiveWithProfile(profile);
Browser* browser = chrome::FindTabbedBrowser(profile, false);
if (!browser)
browser = new Browser(Browser::CreateParams(profile, true));

NavigateParams nav_params(browser, url, ui::PAGE_TRANSITION_LINK);
#endif
nav_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
Expand Down

0 comments on commit 4f060a4

Please sign in to comment.