From 12ab2cbb8ca76fba5584cd8e0f6515f7f6cc5d8d Mon Sep 17 00:00:00 2001 From: Ujjwal Ojha Date: Sun, 8 Apr 2018 08:57:25 +0545 Subject: [PATCH] swap jobType and fn before validating id in job.get --- lib/queue/job.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/queue/job.js b/lib/queue/job.js index 204aff27..bc2a7624 100644 --- a/lib/queue/job.js +++ b/lib/queue/job.js @@ -159,12 +159,13 @@ exports.rangeByType = function( type, state, from, to, order, fn ) { */ exports.get = function( id, jobType, fn ) { - if (id === null || id === undefined) { - return fn(new Error('invalid id param')); - } if (typeof jobType === 'function' && !fn) { fn = jobType; jobType = ''; + } + + if (id === null || id === undefined) { + return fn(new Error('invalid id param')); } var client = redis.client() , job = new Job;