fix: check the result when calling js function (#17443)

* fix: check the result when calling js function

* test: should not crash when callback returns nothing
This commit is contained in:
Cheng Zhao 2019-03-21 00:27:06 +09:00 committed by Shelley Vohr
parent 1571461bae
commit 671533f7d2
5 changed files with 26 additions and 18 deletions

View file

@ -221,7 +221,7 @@ void SpellCheckClient::SpellCheckWords(
v8::Local<v8::Value> args[] = {mate::ConvertToV8(isolate_, words),
templ->GetFunction(context).ToLocalChecked()};
// Call javascript with the words and the callback function
scope.spell_check_->Call(context, scope.provider_, 2, args).ToLocalChecked();
scope.spell_check_->Call(context, scope.provider_, 2, args).IsEmpty();
}
// Returns whether or not the given string is a contraction.