fix: return early on promise rejection (#26095)

This commit is contained in:
David Sanders 2020-10-22 10:53:42 -07:00 committed by GitHub
parent c934d1386b
commit d9db9873fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -978,9 +978,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());