Skip to content

Commit 5547fc1

Browse files
Patch LockMasterSetStatus
See nodegit#1490 (comment) Co-Authored-By: Mehdi Yeganeh <[email protected]>
1 parent def9901 commit 5547fc1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

generate/templates/templates/nodegit.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ void LockMasterSetStatus(const FunctionCallbackInfo<Value>& info) {
6969
Nan::HandleScope scope;
7070

7171
// convert the first argument to Status
72-
if(info.Length() >= 0 && info[0]->IsNumber()) {
73-
v8::Local<v8::Int32> value = info[0]->ToInt32();
74-
LockMaster::Status status = static_cast<LockMaster::Status>(value->Value());
72+
if(info.Length() >= 0 && info[0]->IsUint32()) {
73+
uint value = info[0]->Uint32Value();
74+
75+
LockMaster::Status status = static_cast<LockMaster::Status>(value);
7576
if(status >= LockMaster::Disabled && status <= LockMaster::Enabled) {
7677
LockMaster::SetStatus(status);
7778
return;
@@ -82,6 +83,7 @@ void LockMasterSetStatus(const FunctionCallbackInfo<Value>& info) {
8283
Nan::ThrowError("Argument must be one 0, 1 or 2");
8384
}
8485

86+
8587
void LockMasterGetStatus(const FunctionCallbackInfo<Value>& info) {
8688
info.GetReturnValue().Set(Nan::New(LockMaster::GetStatus()));
8789
}

0 commit comments

Comments
 (0)