Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
fix: add missing handlescope (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 authored Nov 19, 2020
1 parent 74f472b commit 07701fa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/async.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ void SetPasswordWorker::Execute() {
}

void SetPasswordWorker::OnOK() {
Napi::HandleScope scope(Env());
deferred.Resolve(Env().Undefined());
}

void SetPasswordWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}

Expand Down Expand Up @@ -75,6 +77,7 @@ void GetPasswordWorker::Execute() {
}

void GetPasswordWorker::OnOK() {
Napi::HandleScope scope(Env());
Napi::Value val = Env().Null();
if (success) {
val = Napi::String::New(Env(), password.data(),
Expand All @@ -84,6 +87,7 @@ void GetPasswordWorker::OnOK() {
}

void GetPasswordWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}

Expand Down Expand Up @@ -115,10 +119,12 @@ void DeletePasswordWorker::Execute() {
}

void DeletePasswordWorker::OnOK() {
Napi::HandleScope scope(Env());
deferred.Resolve(Napi::Boolean::New(Env(), success));
}

void DeletePasswordWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}

Expand Down Expand Up @@ -150,6 +156,7 @@ void FindPasswordWorker::Execute() {
}

void FindPasswordWorker::OnOK() {
Napi::HandleScope scope(Env());
Napi::Value val = Env().Null();
if (success) {
val = Napi::String::New(Env(), password.data(),
Expand All @@ -159,6 +166,7 @@ void FindPasswordWorker::OnOK() {
}

void FindPasswordWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}

Expand Down Expand Up @@ -190,6 +198,7 @@ void FindCredentialsWorker::Execute() {
}

void FindCredentialsWorker::OnOK() {
Napi::HandleScope scope(Env());
Napi::Env env = Env();

if (success) {
Expand Down Expand Up @@ -228,5 +237,6 @@ void FindCredentialsWorker::OnOK() {
}

void FindCredentialsWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}

0 comments on commit 07701fa

Please sign in to comment.