mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Check plan, return error if not valid.
This prevents a crash later when we refer to properties of the plan object, which can end up being `null` when the `planCode` is either missing, or not a valid code.
This commit is contained in:
parent
1b29e0e8ec
commit
f59d5d836d
1 changed files with 3 additions and 0 deletions
|
@ -16,6 +16,9 @@ module.exports =
|
|||
if subscription?
|
||||
return callback(error) if error?
|
||||
plan = PlansLocator.findLocalPlanInSettings(subscription.planCode)
|
||||
if !plan?
|
||||
err = new Error('No plan found for planCode "#{subscription.planCode}"')
|
||||
return callback(err)
|
||||
RecurlyWrapper.getSubscription subscription.recurlySubscription_id, (err, recurlySubscription)->
|
||||
tax = recurlySubscription?.tax_in_cents || 0
|
||||
callback null, {
|
||||
|
|
Loading…
Reference in a new issue