!4458 fix cppcrash caused by evaluate fail

Merge pull request !4458 from 杨阳/fix_exception
This commit is contained in:
openharmony_ci 2023-07-19 07:11:47 +00:00 committed by Gitee
commit 12bee17dfb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -685,6 +685,7 @@ void DebuggerApi::HandleUncaughtException(const EcmaVM *ecmaVm, std::string &mes
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
JSHandle<JSTaggedValue> exHandle(thread, thread->GetException());
thread->ClearException();
if (exHandle->IsJSError()) {
JSHandle<JSTaggedValue> nameKey = globalConst->GetHandledNameString();
JSHandle<EcmaString> name(JSObject::GetProperty(thread, exHandle, nameKey).GetValue());
@ -695,7 +696,6 @@ void DebuggerApi::HandleUncaughtException(const EcmaVM *ecmaVm, std::string &mes
JSHandle<EcmaString> ecmaStr = JSTaggedValue::ToString(thread, exHandle);
message = ConvertToString(*ecmaStr);
}
thread->ClearException();
}
Local<FunctionRef> DebuggerApi::GenerateFuncFromBuffer(const EcmaVM *ecmaVm, const void *buffer,