diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index 23e397ce6..4b1ee7974 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -242,6 +242,15 @@ class Driver { const reducedLinks = Array.prototype.reduce.call( browser.links, (results, link) => { + // Catch broken links. + if (!link.protocol) { + this.wappalyzer.log("Element is not a valid link interface.", "driver", "error"); + return; + } + if (results == null || !results.hasOwnProperty("push")) { + this.wappalyzer.log("Result object is not an array.", "driver", "error"); + return; + } if (link.protocol.match(/https?:/) && link.hostname === this.origPageUrl.hostname && extensions.test(link.pathname)) { link.hash = '';