From d9db9873fddf96c8f92b6b6355cab9eb30a7a198 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Thu, 22 Oct 2020 10:53:42 -0700 Subject: [PATCH] fix: return early on promise rejection (#26095) --- shell/browser/api/electron_api_session.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index e3a7a61ad4e0..37dff25c68a5 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -978,9 +978,11 @@ v8::Local Session::ListWordsInSpellCheckerDictionary() { SpellcheckService* spellcheck = SpellcheckServiceFactory::GetForContext(browser_context_); - if (!spellcheck) + if (!spellcheck) { promise.RejectWithErrorMessage( "Spellcheck in unexpected state: failed to load custom dictionary."); + return handle; + } if (spellcheck->GetCustomDictionary()->IsLoaded()) { promise.Resolve(spellcheck->GetCustomDictionary()->GetWords());