From f10bc6718cadba1c70d68da641f80ff798a87df2 Mon Sep 17 00:00:00 2001 From: Vahe Hovhannisyan Date: Fri, 27 Dec 2013 14:31:49 -0800 Subject: [PATCH] Account.prototype.line: add a check. --- src/js/ripple/account.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/js/ripple/account.js b/src/js/ripple/account.js index b762462f..0a8d6349 100644 --- a/src/js/ripple/account.js +++ b/src/js/ripple/account.js @@ -212,17 +212,20 @@ Account.prototype.lines = function (callback) { */ Account.prototype.line = function (currency,address,callback) { - var self = this; - var callback = typeof callback === 'function' ? callback : function(){}; + var self = this, + found, + callback = typeof callback === 'function' ? callback : function(){}; self.lines(function(err,data){ data.lines.forEach(function(line){ if (address === line.account && currency === line.currency) { callback(null,line); + found = true; } }); - callback(); + if (!found) + callback(); }); return this;