diff --git a/lib/tools/redownload/redownload.js b/lib/tools/redownload/redownload.js index 484d807..c9cab77 100644 --- a/lib/tools/redownload/redownload.js +++ b/lib/tools/redownload/redownload.js @@ -758,11 +758,13 @@ var Redownload = function() { return request.isHTML && request.weightCheck && request.weightCheck.bodyBuffer; }); + if (!htmlRequest) { + return false; + } + debug('Checking if it is WordPress on file %s', htmlRequest.url); - if (htmlRequest && - (htmlRequest.weightCheck.bodyBuffer.indexOf('/wp-content/') >= 0 || - htmlRequest.weightCheck.bodyBuffer.indexOf('/wp-includes/') >= 0)) { + if (htmlRequest.weightCheck.bodyBuffer.indexOf('/wp-content/') >= 0 || htmlRequest.weightCheck.bodyBuffer.indexOf('/wp-includes/') >= 0) { debug('Response: yes.'); return true; } else {