Skip to content

Commit

Permalink
Patch LockMasterSetStatus
Browse files Browse the repository at this point in the history
See nodegit#1490 (comment)

Co-Authored-By: Mehdi Yeganeh <[email protected]>
  • Loading branch information
Croydon and mehdi-yeganeh committed Sep 20, 2018
1 parent 640717c commit e14aa05
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions generate/templates/templates/nodegit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ void LockMasterSetStatus(const FunctionCallbackInfo<Value>& info) {
Nan::HandleScope scope;

// convert the first argument to Status
if(info.Length() >= 0 && info[0]->IsNumber()) {
v8::Local<v8::Int32> value = info[0]->ToInt32();
LockMaster::Status status = static_cast<LockMaster::Status>(value->Value());
if(info.Length() >= 0 && info[0]->IsUint32()) {
uint value = info[0]->Uint32Value();

LockMaster::Status status = static_cast<LockMaster::Status>(value);
if(status >= LockMaster::Disabled && status <= LockMaster::Enabled) {
LockMaster::SetStatus(status);
return;
Expand All @@ -82,6 +83,7 @@ void LockMasterSetStatus(const FunctionCallbackInfo<Value>& info) {
Nan::ThrowError("Argument must be one 0, 1 or 2");
}


void LockMasterGetStatus(const FunctionCallbackInfo<Value>& info) {
info.GetReturnValue().Set(Nan::New(LockMaster::GetStatus()));
}
Expand Down

0 comments on commit e14aa05

Please sign in to comment.