fix(napi): dropping Error should not call napi-sys if feature is set to noop (#1477)

This commit is contained in:
Hana 2023-02-07 15:45:56 +08:00 committed by GitHub
parent c70c76d8f3
commit 31015652b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -162,6 +162,8 @@ impl From<std::io::Error> for Error {
impl Drop for Error {
fn drop(&mut self) {
#[cfg(not(feature = "noop"))]
{
if !self.maybe_env.is_null() && !self.maybe_raw.is_null() {
let delete_reference_status =
unsafe { sys::napi_delete_reference(self.maybe_env, self.maybe_raw) };
@ -172,6 +174,7 @@ impl Drop for Error {
}
}
}
}
#[derive(Clone, Debug)]
pub struct ExtendedErrorInfo {