Commit d602d5b1b05036788c67c13510c34725c68116ea

Authored by Dmitriy Zaporozhets
1 parent 02e859a2

Fix find_diff for note when noteable is nil

Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
app/models/note.rb
@@ -71,7 +71,7 @@ class Note < ActiveRecord::Base @@ -71,7 +71,7 @@ class Note < ActiveRecord::Base
71 end 71 end
72 72
73 def find_diff 73 def find_diff
74 - return nil unless noteable.diffs.present? 74 + return nil unless noteable && noteable.diffs.present?
75 75
76 @diff ||= noteable.diffs.find do |d| 76 @diff ||= noteable.diffs.find do |d|
77 Digest::SHA1.hexdigest(d.new_path) == diff_file_index if d.new_path 77 Digest::SHA1.hexdigest(d.new_path) == diff_file_index if d.new_path