From 4deaf7865da6f939241c87a1b83d986775dbd30b Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 16 May 2018 16:33:26 +0100 Subject: [PATCH] Guard against no apis.v1 setting --- .../coffee/Features/Subscription/V1SubscriptionManager.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/Subscription/V1SubscriptionManager.coffee b/services/web/app/coffee/Features/Subscription/V1SubscriptionManager.coffee index 37460cd773..05dc140be2 100644 --- a/services/web/app/coffee/Features/Subscription/V1SubscriptionManager.coffee +++ b/services/web/app/coffee/Features/Subscription/V1SubscriptionManager.coffee @@ -20,7 +20,7 @@ module.exports = V1SubscriptionManager = return callback(null, null) V1SubscriptionManager._v1PlanRequest v1Id, (err, body) -> return callback(err) if err? - planName = body.plan_name + planName = body?.plan_name logger.log {userId, planName, body}, "[V1SubscriptionManager] fetched v1 plan for user" if planName in ['pro', 'pro_plus', 'student', 'free'] planName = "v1_#{planName}" @@ -30,6 +30,8 @@ module.exports = V1SubscriptionManager = return callback(null, planName) _v1PlanRequest: (v1Id, callback=(err, body)->) -> + if !settings?.apis?.v1 + return callback null, null request { method: 'GET', url: settings.apis.v1.url +