summaryrefslogtreecommitdiffstats
path: root/app/models/version.rb
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 /app/models/version.rb
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 'app/models/version.rb')
-rw-r--r--app/models/version.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/version.rb b/app/models/version.rb
index f5ac64b74..77228826c 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -316,6 +316,8 @@ class Version < ActiveRecord::Base
# Versions are sorted by effective_date and name
# Those with no effective_date are at the end, sorted by name
def <=>(version)
+ return nil unless version.is_a?(Version)
+
if self.effective_date
if version.effective_date
if self.effective_date == version.effective_date