diff --git a/app/models/footprintable.rb b/app/models/footprintable.rb index 18f17d1e5..33dc4774d 100644 --- a/app/models/footprintable.rb +++ b/app/models/footprintable.rb @@ -20,7 +20,7 @@ class Footprintable < ApplicationRecord return false unless persisted? reload - footprint_children.map(&:check_footprint).all? && !chained_element.corrupted? + footprint_children.map(&:check_footprint).all? && chained_element && !chained_element.corrupted? end # @return [ChainedElement] diff --git a/app/views/api/payment_schedules/_payment_schedule.json.jbuilder b/app/views/api/payment_schedules/_payment_schedule.json.jbuilder index 8875f10c0..73b5ecbbc 100644 --- a/app/views/api/payment_schedules/_payment_schedule.json.jbuilder +++ b/app/views/api/payment_schedules/_payment_schedule.json.jbuilder @@ -14,8 +14,8 @@ if payment_schedule.operator_profile end end json.main_object do - json.type payment_schedule.main_object.object_type - json.id payment_schedule.main_object.object_id + json.type payment_schedule.main_object&.object_type + json.id payment_schedule.main_object&.object_id end if payment_schedule.gateway_subscription # this attribute is used to known which gateway should we interact with, in the front-end