fix(ThreadsafeFunction): ensure CalleeHandled works as expected (#2039)

This was refactored in 4719caa643. This codepath
was swapped, as the fatal exception must be the normal codepath when the callee
handled field is false. This fixes it by swapping this if statement, all the
other calls have been checked and seem fine.
This commit is contained in:
Louis 2024-04-15 16:19:15 +01:00 committed by GitHub
parent cc937e1dba
commit 19dbadefba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -658,7 +658,7 @@ unsafe extern "C" fn call_js_cb<
) )
}, },
Err(e) => { Err(e) => {
if CalleeHandled { if !CalleeHandled {
unsafe { sys::napi_fatal_exception(raw_env, JsError::from(e).into_value(raw_env)) } unsafe { sys::napi_fatal_exception(raw_env, JsError::from(e).into_value(raw_env)) }
} else { } else {
unsafe { unsafe {