Skip to content

Commit

Permalink
type check second argument
Browse files Browse the repository at this point in the history
  • Loading branch information
SirWaddles committed Nov 16, 2020
1 parent 6472401 commit 6188ee5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion native/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "node-wick"
version = "4.0.1"
version = "4.0.2"
edition = "2018"
authors = ["Waddlesworth <[email protected]>"]
license = "MIT"
Expand Down
8 changes: 6 additions & 2 deletions native/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,12 @@ declare_types! {

let ubulk_js = match cx.argument_opt(1) {
Some(arg) => {
let buf_ref = arg.downcast_or_throw(&mut cx)?;
Some(get_buffer_contents(&mut cx, buf_ref))
if arg.is_a::<JsBuffer>() {
let buf_ref = arg.downcast_or_throw(&mut cx)?;
Some(get_buffer_contents(&mut cx, buf_ref))
} else {
None
}
},
None => None,
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-wick",
"version": "4.0.1",
"version": "4.0.2",
"description": "NodeJS Bindings for the JohnWickParse library",
"main": "lib/index.js",
"repository": {
Expand Down

0 comments on commit 6188ee5

Please sign in to comment.