From c972b1f32b547c1a96c7c121c42a36bc0c0f85c0 Mon Sep 17 00:00:00 2001 From: Drew Willcoxon Date: Thu, 19 Jul 2018 17:15:02 +0000 Subject: [PATCH] Bug 1476674 - Fix crash in nsNavHistory::RecalculateOriginFrecencyStats r=mak Differential Revision: https://phabricator.services.mozilla.com/D2232 --HG-- extra : moz-landing-system : lando --- toolkit/components/places/Database.cpp | 4 +++- toolkit/components/places/nsNavHistory.cpp | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index 9ba614121158..30938c603b8e 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -2728,7 +2728,9 @@ Database::MigrateV52OriginFrecencies() new MigrateV52OriginFrecenciesRunnable(mMainConn)); nsCOMPtr target(do_GetInterface(mMainConn)); MOZ_ASSERT(target); - Unused << target->Dispatch(runnable, NS_DISPATCH_NORMAL); + if (target) { + Unused << target->Dispatch(runnable, NS_DISPATCH_NORMAL); + } } nsresult diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index 450ae72fbec0..4881254cc061 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -714,9 +714,8 @@ nsNavHistory::RecalculateOriginFrecencyStats(nsIObserver *aCallback) ) ); - nsCOMPtr conn = mDB->MainConn(); - nsCOMPtr target = do_GetInterface(conn); - MOZ_ASSERT(target); + nsCOMPtr target(do_GetInterface(mDB->MainConn())); + NS_ENSURE_STATE(target); nsresult rv = target->Dispatch(NS_NewRunnableFunction( "nsNavHistory::RecalculateOriginFrecencyStats", [self, callback] {