diff options
author | Go MAEDA <maeda@farend.jp> | 2023-06-29 14:42:54 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-06-29 14:42:54 +0000 |
commit | 945a82b5c0aad6bd6af656865015277d3e0e612b (patch) | |
tree | d6bf1c4e7fdf2bb5d32b55ae7e5c0477b31377c9 /app/models/issue.rb | |
parent | ebf3fb3b4fa53f3bc6f9cbbcd529c6b296d4f6fc (diff) | |
download | redmine-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/issue.rb')
-rw-r--r-- | app/models/issue.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index d6d6c7c8b..e23b02647 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1435,9 +1435,9 @@ class Issue < ActiveRecord::Base end def <=>(issue) - if issue.nil? - -1 - elsif root_id != issue.root_id + return nil unless issue.is_a?(Issue) + + if root_id != issue.root_id (root_id || 0) <=> (issue.root_id || 0) else (lft || 0) <=> (issue.lft || 0) |