Commit 31cc9249 authored by jplang's avatar jplang

Fixed undefined method `<=>' for nil:NilClass when sorting repositories with...

Fixed undefined method `<=>' for nil:NilClass when sorting repositories with nil identifiers (#10827).

git-svn-id: https://svn.redmine.org/redmine/trunk@9619 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent a096b7bd
......@@ -119,7 +119,7 @@ class Repository < ActiveRecord::Base
elsif repository.is_default?
1
else
identifier <=> repository.identifier
identifier.to_s <=> repository.identifier.to_s
end
end
......
......@@ -318,4 +318,13 @@ class RepositoryTest < ActiveSupport::TestCase
assert_equal "test_value_23",
repo.extra_info["test_2"]["test_23"]
end
def test_sort_should_not_raise_an_error_with_nil_identifiers
r1 = Repository.new
r2 = Repository.new
assert_nothing_raised do
[r1, r2].sort
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment