Skip to content

Commit

Permalink
Perform argument check for putString
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Mar 12, 2022
1 parent 4b659d1 commit 9776010
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/txn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ Nan::NAN_METHOD_RETURN_TYPE TxnWrap::putCommon(Nan::NAN_METHOD_ARGS_TYPE info, v
}

NAN_METHOD(TxnWrap::putString) {
if (!info[2]->IsString())
return Nan::ThrowError("Value must be a string.");
return putCommon(info, [](Nan::NAN_METHOD_ARGS_TYPE info, MDB_val &data) -> void {
CustomExternalStringResource::writeTo(Local<String>::Cast(info[2]), &data);
}, [](MDB_val &data) -> void {
Expand Down

0 comments on commit 9776010

Please sign in to comment.