fix(napi): dropping Error should not call napi-sys if feature is set to noop (#1477)
This commit is contained in:
parent
c70c76d8f3
commit
31015652b8
1 changed files with 10 additions and 7 deletions
|
@ -162,13 +162,16 @@ impl From<std::io::Error> for Error {
|
||||||
|
|
||||||
impl Drop for Error {
|
impl Drop for Error {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if !self.maybe_env.is_null() && !self.maybe_raw.is_null() {
|
#[cfg(not(feature = "noop"))]
|
||||||
let delete_reference_status =
|
{
|
||||||
unsafe { sys::napi_delete_reference(self.maybe_env, self.maybe_raw) };
|
if !self.maybe_env.is_null() && !self.maybe_raw.is_null() {
|
||||||
debug_assert!(
|
let delete_reference_status =
|
||||||
delete_reference_status == sys::Status::napi_ok,
|
unsafe { sys::napi_delete_reference(self.maybe_env, self.maybe_raw) };
|
||||||
"Delete Error Reference failed"
|
debug_assert!(
|
||||||
);
|
delete_reference_status == sys::Status::napi_ok,
|
||||||
|
"Delete Error Reference failed"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue