Commit 5d5380a79a2e21e05619d03f4bbb6cca4ac957f3
1 parent
d7093949
Exists in
master
and in
22 other branches
return empty array when nil profile is passed as parameter
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
app/models/article.rb
| ... | ... | @@ -487,8 +487,8 @@ class Article < ActiveRecord::Base |
| 487 | 487 | scope :more_recent, :order => "created_at DESC" |
| 488 | 488 | |
| 489 | 489 | scope :display_filter, lambda {|user, profile| |
| 490 | - return published if (user.nil? && profile.public?) | |
| 491 | - return [] if user.nil? || (!profile.public? && !user.follows?(profile)) | |
| 490 | + return published if (user.nil? && profile && profile.public?) | |
| 491 | + return [] if user.nil? || profile.nil? || (!profile.public? && !user.follows?(profile)) | |
| 492 | 492 | where( |
| 493 | 493 | [ |
| 494 | 494 | "published = ? OR last_changed_by_id = ? OR profile_id = ? OR ? | ... | ... |