Skip to content

Commit f31b20e

Browse files
committed
Error parameter to callback should be null on no error, not undefined.
1 parent 885de16 commit f31b20e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/njsCommon.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,10 @@ void njsBaton::AsyncAfterWorkCallback(uv_work_t *req, int status)
304304
Local<Value> *callbackArgs = new Local<Value>[baton->numCallbackArgs];
305305
unsigned int i, numCallbackArgs = baton->numCallbackArgs;
306306

307-
// set all parameters as undefined
308-
for (i = 0; i < numCallbackArgs; i++)
307+
// set all parameters but the first as undefined; the first parameter is
308+
// always expected to be the error and should be null
309+
callbackArgs[0] = Nan::Null();
310+
for (i = 1; i < numCallbackArgs; i++)
309311
callbackArgs[i] = Nan::Undefined();
310312

311313
// if no error so far, call the after work callback, if needed

0 commit comments

Comments
 (0)