summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-06-29 14:42:54 +0000
committerGo MAEDA <maeda@farend.jp>2023-06-29 14:42:54 +0000
commit945a82b5c0aad6bd6af656865015277d3e0e612b (patch)
treed6bf1c4e7fdf2bb5d32b55ae7e5c0477b31377c9 /lib
parentebf3fb3b4fa53f3bc6f9cbbcd529c6b296d4f6fc (diff)
downloadredmine-945a82b5c0aad6bd6af656865015277d3e0e612b.tar.gz
redmine-945a82b5c0aad6bd6af656865015277d3e0e612b.zip
<=> operator should return nil when invoked with an incomparable object (#38772).
Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@22269 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/plugin.rb2
-rw-r--r--lib/redmine/themes.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb
index b7f243354..79e310f31 100644
--- a/lib/redmine/plugin.rb
+++ b/lib/redmine/plugin.rb
@@ -187,6 +187,8 @@ module Redmine
end
def <=>(plugin)
+ return nil unless plugin.is_a?(Plugin)
+
self.id.to_s <=> plugin.id.to_s
end
diff --git a/lib/redmine/themes.rb b/lib/redmine/themes.rb
index a73184090..ff51f0083 100644
--- a/lib/redmine/themes.rb
+++ b/lib/redmine/themes.rb
@@ -61,6 +61,8 @@ module Redmine
end
def <=>(theme)
+ return nil unless theme.is_a?(Theme)
+
name <=> theme.name
end