From 41c25cb3ef03aef7725f7717a8bb9c8cec411975 Mon Sep 17 00:00:00 2001 From: David Gay Date: Fri, 28 May 2021 15:43:23 -0400 Subject: Add a quick guard to `HearthAmenity#construct_activity` --- app/models/hearth_amenity.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/hearth_amenity.rb b/app/models/hearth_amenity.rb index a5dde23..52ca85e 100644 --- a/app/models/hearth_amenity.rb +++ b/app/models/hearth_amenity.rb @@ -4,6 +4,7 @@ class HearthAmenity < ApplicationRecord validates :gid, :name, :description, presence: true def construct_activity(level) + return nil unless self.whatnot activity_data = self.whatnot[:construct_activities].find { |a| a[:level] == level } return nil unless activity_data Activity.find_by_gid(activity_data[:gid]) -- cgit v1.2.3