fix: return early on promise rejection (#26110)

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
trop[bot]
2020-10-22 14:45:09 -05:00
committed by GitHub
parent 0992fb35ea
commit 4a312e9c6b

View File

@@ -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());