From f135021c52d2a6a5964621dc9ce5b1ed40e310e1 Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Sun, 5 Jan 2014 14:09:20 -0800 Subject: [PATCH] Fix endless loop when creating an Account object for a non-existent account. --- src/js/ripple/account.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/ripple/account.js b/src/js/ripple/account.js index b9c3494d..be252e9a 100644 --- a/src/js/ripple/account.js +++ b/src/js/ripple/account.js @@ -163,7 +163,10 @@ Account.prototype.getNextSequence = function(callback) { var callback = typeof callback === 'function' ? callback : function(){}; function accountInfo(err, info) { - if (err) { + if (err && err.error === "actNotFound") { + // New accounts will start out as sequence zero + callback(null, 0); + } else if (err) { callback(err); } else { callback(null, info.account_data.Sequence);