Prevent errors when asking anonymous questions

This commit is contained in:
Karina Kwiatek 2022-06-13 16:12:06 +02:00
parent 677480902d
commit 14e84fd47c
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@ class Inbox < ApplicationRecord
end
def answer(answer_content, user)
raise Errors::AnsweringOtherBlockedSelf if question.user.blocking?(user)
raise Errors::AnsweringOtherBlockedSelf if question.user&.blocking?(user)
raise Errors::AnsweringSelfBlockedOther if user.blocking?(question.user)
answer = user.answer(self.question, answer_content)