From bbb48b12352e39fc9abe359931f4916d3dafb5fd Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 4 Jun 2014 16:27:45 -0400 Subject: [PATCH] Handle the case where the plans do not load correctly. --- static/js/app.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index 86f915723..397729c3b 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1093,20 +1093,17 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading planService.verifyLoaded = function(callback) { if (!Features.BILLING) { return; } - if (plans) { + if (plans && plans.length) { callback(plans); return; } ApiService.listPlans().then(function(data) { - var i = 0; - for(i = 0; i < data.plans.length; i++) { - planDict[data.plans[i].stripeId] = data.plans[i]; - } - plans = data.plans; - if (plans) { - callback(plans); + plans = data.plans || []; + for(var i = 0; i < plans.length; i++) { + planDict[plans[i].stripeId] = plans[i]; } + callback(plans); }, function() { callback([]); }); };