Skip to content

Commit

Permalink
Avoid errors when mail has no configuration file at all
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Jun 2, 2014
1 parent 04133b2 commit 70ec375
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/mail.rb
Expand Up @@ -43,7 +43,7 @@ def Util.get_mailing_list_receivers(list_id)
end
def Util.get_mailing_list_anrede(list_id)
Util.configure_mail unless @mail_configured
return [] unless @cfg[MailingListIds] and @cfg[MailingListIds].index(list_id)
return [] unless @cfg and @cfg[MailingListIds] and @cfg[MailingListIds].index(list_id)
anreden = []
@cfg[MailingRecipients].each { |recipient| anreden << recipient[:anrede] if recipient[:lists].index(list_id) and recipient[:anrede]}
anreden.sort
Expand Down Expand Up @@ -78,7 +78,7 @@ def Util.configure_mail(deliver_using = :oddb_yml)
end
end
end
msg = "#{__FILE__}: Configured email using #{@cfg['smtp_server'].inspect} #{@cfg['smtp_port'].inspect} #{@cfg['smtp_user'].inspect}"
msg = "#{__FILE__}: Configured email using #{@cfg ? @cfg['smtp_server'].inspect : 'nil' } #{@cfg ? @cfg['smtp_port'].inspect : ''} #{@cfg ? @cfg['smtp_user'].inspect : ''}"
Util.debug_msg(msg)
@mail_configured
end
Expand Down

0 comments on commit 70ec375

Please sign in to comment.