avoid calling author on nil object

Change-Id: I6b6a5fb537a3e6fbd8321d124f3e4e3b905995e7
Reviewed-on: https://gerrit.instructure.com/16335
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2012-12-22 08:05:43 -07:00
parent dc8d35802b
commit 8adadea4ee
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ module StreamItemsHelper
end
next if participant.last_message.nil? || participant.last_author?
item.data.write_attribute(:last_message, participant.last_message)
item.data.write_attribute(:last_author, item.data.last_message.author)
item.data.write_attribute(:last_author, item.data.last_message.try(:author))
# because we're cheating and just checking unread here instead of using
# the workflow_state on the stream_item_instance, that workflow_state