Browse Source

fix: return early on promise rejection (#26110)

Co-authored-by: David Sanders <[email protected]>
trop[bot] 4 years ago
parent
commit
4a312e9c6b
1 changed files with 3 additions and 1 deletions
  1. 3 1
      shell/browser/api/electron_api_session.cc

+ 3 - 1
shell/browser/api/electron_api_session.cc

@@ -867,9 +867,11 @@ v8::Local<v8::Promise> 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());