caolan/async — Issue #71: minor bug in .waterfall()
Author: debonet
Created: 2011-12-05 04:18:47+00:00
State: open

Function reads:

async.waterfall = function (tasks, callback) {
if (!tasks.length) {
return callback();
}
callback = callback || function () {};
....

should be:

async.waterfall = function (tasks, callback) {
callback = callback || function () {};
if (!tasks.length) {
return callback();
}
....

Just in case the tasks are empty and the callback is null

Better yet, you could check to make sure tasks is defined as well:

async.waterfall = function (tasks, callback) {
callback = callback || function () {};
if (!tasks || !tasks.length) {
return callback();
}
....