fix(napi) undefined is recognized as a valid None for Option<T>.

This commit is contained in:
Ivan Enderlin 2022-07-07 15:50:55 +02:00
parent 087b3ed594
commit 1259ce1ba4

View file

@ -169,7 +169,7 @@ impl<T: ValidateNapiValue> ValidateNapiValue for Option<T> {
)?;
let received_type = ValueType::from(result);
if received_type == ValueType::Null {
if received_type == ValueType::Null || received_type == ValueType::Undefined {
Ok(ptr::null_mut())
} else if let Ok(validate_ret) = unsafe { T::validate(env, napi_val) } {
Ok(validate_ret)