From 20e13164914966e166ec304c6c89217a6ca00ce2 Mon Sep 17 00:00:00 2001 From: MrZYX Date: Sun, 13 Feb 2011 19:29:04 +0100 Subject: [PATCH] it can somehow happen that a person has no profile. somehow. idk why. --- app/helpers/application_helper.rb | 2 +- app/models/person.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0c677a990..9f7b1d3e3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -148,7 +148,7 @@ module ApplicationHelper end def person_image_link(person, opts = {}) - return "" if person.nil? + return "" if person.nil? || person.profile.nil? if opts[:to] == :photos link_to person_image_tag(person, opts[:size]), person_photos_path(person) else diff --git a/app/models/person.rb b/app/models/person.rb index 4f360e81e..19bfbac4e 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -75,7 +75,7 @@ class Person < ActiveRecord::Base end def name(opts = {}) - @name ||= if profile.first_name.nil? || profile.first_name.blank? + @name ||= if profile.nil? || profile.first_name.nil? || profile.first_name.blank? self.diaspora_handle else "#{profile.first_name.to_s} #{profile.last_name.to_s}" @@ -83,7 +83,7 @@ class Person < ActiveRecord::Base end def first_name - @first_name ||= if profile.first_name.nil? || profile.first_name.blank? + @first_name ||= if profile.nil? || profile.first_name.nil? || profile.first_name.blank? self.diaspora_handle.split('@').first else profile.first_name.to_s