diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc index 522d3c24cfba70..3e9894608b3791 100644 --- a/src/node_sqlite.cc +++ b/src/node_sqlite.cc @@ -2254,6 +2254,8 @@ void DatabaseSync::ApplyChangeset(const FunctionCallbackInfo& args) { return; } + Local conflictFunc; + Local filterFunc; if (args.Length() > 1 && !args[1]->IsUndefined()) { if (!args[1]->IsObject()) { THROW_ERR_INVALID_ARG_TYPE(env->isolate(), @@ -2276,7 +2278,7 @@ void DatabaseSync::ApplyChangeset(const FunctionCallbackInfo& args) { "The \"options.onConflict\" argument must be a function."); return; } - Local conflictFunc = conflictValue.As(); + conflictFunc = conflictValue.As(); context.conflictCallback = [env, conflictFunc](int conflictType) -> int { Local argv[] = {Integer::New(env->isolate(), conflictType)}; TryCatch try_catch(env->isolate()); @@ -2313,7 +2315,7 @@ void DatabaseSync::ApplyChangeset(const FunctionCallbackInfo& args) { return; } - Local filterFunc = filterValue.As(); + filterFunc = filterValue.As(); context.filterCallback = [env, db, filterFunc](std::string_view item) -> bool {