diff --git a/src/statement.cc b/src/statement.cc index 9f6a9cd1e..d13c5e5fe 100644 --- a/src/statement.cc +++ b/src/statement.cc @@ -579,8 +579,10 @@ void Statement::Work_AfterAll(napi_env e, napi_status status, void* data) { if (stmt->status != SQLITE_DONE) { Error(baton.get()); + STATEMENT_END(); } else { + STATEMENT_END(); // Fire callbacks. Napi::Function cb = baton->callback.Value(); if (!cb.IsUndefined() && cb.IsFunction()) { @@ -607,8 +609,6 @@ void Statement::Work_AfterAll(napi_env e, napi_status status, void* data) { } } } - - STATEMENT_END(); } Napi::Value Statement::Each(const Napi::CallbackInfo& info) {