summaryrefslogtreecommitdiffstats
path: root/app/models/principal.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-12 14:54:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-12 14:54:30 +0000
commitd289619c757b52849002e0a78ecc4b45065cb8af (patch)
treea7895d1f3106437a17d492adadc34c4fdd224b79 /app/models/principal.rb
parent10a462369b4c59891d60da69876c2d290feb7d58 (diff)
downloadredmine-d289619c757b52849002e0a78ecc4b45065cb8af.tar.gz
redmine-d289619c757b52849002e0a78ecc4b45065cb8af.zip
Fixed potential error when sorting members without role (#10053).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8863 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/principal.rb')
-rw-r--r--app/models/principal.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/principal.rb b/app/models/principal.rb
index 77fe19fe0..5c4e17a8b 100644
--- a/app/models/principal.rb
+++ b/app/models/principal.rb
@@ -50,7 +50,9 @@ class Principal < ActiveRecord::Base
end
def <=>(principal)
- if self.class.name == principal.class.name
+ if principal.nil?
+ -1
+ elsif self.class.name == principal.class.name
self.to_s.downcase <=> principal.to_s.downcase
else
# groups after users