Skip to content

Commit deb8c53

Browse files
committed
handle null
1 parent 5c3bc7b commit deb8c53

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/canWrapper.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ Napi::Promise writeDfuToBin(const Napi::CallbackInfo& info) {
676676
std::string binFileName = info[1].As<Napi::String>().Utf8Value();
677677
int elementIndex;
678678

679-
if(info[2].IsUndefined()) {
679+
if(info[2].IsUndefined() || info[2].IsNull()) {
680680
elementIndex = 0;
681681
} else {
682682
elementIndex = info[2].As<Napi::Number>().Int32Value();

0 commit comments

Comments
 (0)