From c257bd5ffac25ab26ca31f43af2a0607668d781f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 16 Sep 2014 09:39:04 -0700 Subject: Check for empty transactions array --- routes/transactions.js | 4 ++++ routes/users.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'routes') diff --git a/routes/transactions.js b/routes/transactions.js index 28fd2418..759ec14a 100644 --- a/routes/transactions.js +++ b/routes/transactions.js @@ -25,6 +25,10 @@ }; return db.lrange("" + user + ":transactions", 0, -1, function(err, transactions) { var cb, i, txid; + if (err || !transactions.length) { + res.write(JSON.stringify(r)); + return res.end(); + } txid = function() { var x; x = transactions[i++]; diff --git a/routes/users.js b/routes/users.js index 37ce9774..46a8f8f8 100644 --- a/routes/users.js +++ b/routes/users.js @@ -121,7 +121,7 @@ if (host === 'localhost') { host += ':3000'; } - url = "" + req.protocol + "://" + req.hostname + ":3000/verify/" + token; + url = "" + req.protocol + "://" + host + "/verify/" + token; return res.render('users/welcome', { user: req.params.user, layout: 'mail', -- cgit v1.2.3