From 84b333e5c1feae9cd2e46007dbcb1a2475f48eaf Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Wed, 13 May 2015 15:34:23 -0500 Subject: [PATCH] fix(unlocks): Handle undefined/null balance --- common/script/index.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/script/index.coffee b/common/script/index.coffee index 10e3acc352..f251ad7db5 100644 --- a/common/script/index.coffee +++ b/common/script/index.coffee @@ -892,7 +892,7 @@ api.wrap = (user, main=true) -> else if fullSet then 1.25 else 0.5 alreadyOwns = !fullSet and user.fns.dotGet("purchased." + path) is true - return cb?({code:401, message: i18n.t('notEnoughGems', req.language)}) if user.balance < cost and !alreadyOwns + return cb?({code:401, message: i18n.t('notEnoughGems', req.language)}) if (user.balance < cost or !user.balance) and !alreadyOwns if fullSet _.each path.split(","), (p) -> if ~path.indexOf('gear.')