From 714a6efb3bf13d00542f16089cc2ae4952d5efa5 Mon Sep 17 00:00:00 2001 From: Ehsan Khakifirooz Date: Wed, 5 Jul 2017 15:31:01 +0100 Subject: [PATCH] Fix for the case of giving erroneous value to {id} and function value to {jobType} arguments, in Job.get method --- .gitignore | 1 + lib/queue/job.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4fc877d6..0232292b 100755 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules *.rdb test/incomplete *.swp +yarn.lock diff --git a/lib/queue/job.js b/lib/queue/job.js index 204aff27..bbac4740 100644 --- a/lib/queue/job.js +++ b/lib/queue/job.js @@ -159,13 +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;