Merge pull request #1228 from Hywan/fix-option-t-null
fix(napi) `undefined` is recognized as a valid `None` for `Option<T>`
This commit is contained in:
commit
d0a9cbfa86
1 changed files with 1 additions and 1 deletions
|
@ -169,7 +169,7 @@ impl<T: ValidateNapiValue> ValidateNapiValue for Option<T> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let received_type = ValueType::from(result);
|
let received_type = ValueType::from(result);
|
||||||
if received_type == ValueType::Null {
|
if received_type == ValueType::Null || received_type == ValueType::Undefined {
|
||||||
Ok(ptr::null_mut())
|
Ok(ptr::null_mut())
|
||||||
} else if let Ok(validate_ret) = unsafe { T::validate(env, napi_val) } {
|
} else if let Ok(validate_ret) = unsafe { T::validate(env, napi_val) } {
|
||||||
Ok(validate_ret)
|
Ok(validate_ret)
|
||||||
|
|
Loading…
Reference in a new issue