Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Spencer <jon@jonspencer.ca>2013-09-02 09:20:20 +0400
committerisaacs <i@izs.me>2013-09-05 09:28:33 +0400
commit4b5112288176e61255b701acb9601cc105d0073b (patch)
tree5b42de487062380bed447d42a5c39b1324383bce
parentd6d0618270329725dc0d94f2fd209203fd639def (diff)
update/outdated: don't access missing package info
avoid null dereferences checking the status of a currently installed package Fixes #3820, a regression caused by #3798 and #3578
-rw-r--r--lib/outdated.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/outdated.js b/lib/outdated.js
index 148dd973e..d9ef3ca0b 100644
--- a/lib/outdated.js
+++ b/lib/outdated.js
@@ -144,7 +144,7 @@ function shouldUpdate (args, dir, dep, has, req, cb) {
}
function doIt (shouldHave) {
- cb(null, [[ dir, dep, curr.version, shouldHave, req ]])
+ cb(null, [[ dir, dep, curr && curr.version, shouldHave, req ]])
}
if (args.length && args.indexOf(dep) === -1) {
@@ -159,11 +159,11 @@ function shouldUpdate (args, dir, dep, has, req, cb) {
// check that the url origin hasn't changed (#1727) and that
// there is no newer version available
- var dFromUrl = url.parse(d._from).protocol
- var cFromUrl = url.parse(curr.from).protocol
+ var dFromUrl = d._from && url.parse(d._from).protocol
+ var cFromUrl = curr && curr.from && url.parse(curr.from).protocol
- if (dFromUrl && cFromUrl && d._from !== curr.from
- || d.version !== has[dep].version)
+ if (!curr || dFromUrl && cFromUrl && d._from !== curr.from
+ || d.version !== curr.version)
doIt(d.version)
else
skip()