Skip to content

Commit

Permalink
Handle blank communities config
Browse files Browse the repository at this point in the history
  • Loading branch information
fbacall committed Jan 9, 2025
1 parent e2d6124 commit 2e8b69c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/community.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ class Community

def self.find(id)
return nil if id.nil?
if TeSS::Config.communities.key?(id)
if TeSS::Config.communities&.key?(id)
self.new(TeSS::Config.communities[id].merge(id: id))
end
end

def self.for_country(country_data)
return nil if country_data.nil?
return nil if TeSS::Config.communities.blank?
id = TeSS::Config.communities.find do |_, data|
data.key?('country_code') && data['country_code'] == country_data['iso_code']
end&.first
Expand Down

0 comments on commit 2e8b69c

Please sign in to comment.