Skip to content

Commit

Permalink
fix: check exception before JS_ExecutePendingJob
Browse files Browse the repository at this point in the history
  • Loading branch information
HarlonWang committed Apr 3, 2023
1 parent 792f347 commit 821e715
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions native/cpp/quickjs_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ static bool throwIfUnhandledRejections(QuickJSWrapper *wrapper, JSContext *ctx)
}

static bool executePendingJobLoop(JNIEnv *env, JSRuntime *rt, JSContext *ctx) {
if (env->ExceptionCheck()) {
return false;
}

JSContext *ctx1;
bool success = true;
int err;
Expand Down Expand Up @@ -543,10 +547,6 @@ jobject QuickJSWrapper::evaluate(JNIEnv *env, jobject thiz, jstring script, jstr
return nullptr;
}

if (env->ExceptionCheck()) {
return nullptr;
}

JSValue global = JS_GetGlobalObject(context);
jobject jsObj = toJavaObject(env, thiz, global, result);
JS_FreeValue(context, global);
Expand Down

0 comments on commit 821e715

Please sign in to comment.