From fc068b62a26a67f1255b9181f604c340502a689b Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 17 Aug 2016 08:51:35 +0100 Subject: [PATCH] defend against undefined plan_code --- .../Features/Subscription/SubscriptionController.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee b/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee index fbc72a277e..d4521981e4 100644 --- a/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee +++ b/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee @@ -170,6 +170,10 @@ module.exports = SubscriptionController = AuthenticationController.getLoggedInUser req, (error, user) -> return next(error) if error? planCode = req.body.plan_code + if !planCode? + err = new Error('plan_code not defined') + logger.err {user_id: user._id, err}, "error updating subscription" + return next(err) logger.log planCode: planCode, user_id:user._id, "updating subscription" SubscriptionHandler.updateSubscription user, planCode, null, (err)-> if err?