From: Jean-Philippe Lang Date: Wed, 9 Dec 2009 09:22:16 +0000 (+0000) Subject: Fixed: Bulk edit of issues throws 500 if no versions are defined on the project ... X-Git-Tag: 0.9.0~122 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b0900989524e8796b77eed1d482ee712d3d10c29;p=redmine.git Fixed: Bulk edit of issues throws 500 if no versions are defined on the project (#4366). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3140 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index b675f6b34..896c54d92 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -84,7 +84,7 @@ module ProjectsHelper if grouped.keys.size > 1 grouped_options_for_select(grouped, selected && selected.id) else - options_for_select(grouped.values.first, selected && selected.id) + options_for_select((grouped.values.first || []), selected && selected.id) end end diff --git a/test/unit/helpers/projects_helper_test.rb b/test/unit/helpers/projects_helper_test.rb index ce9598841..ff99a15c9 100644 --- a/test/unit/helpers/projects_helper_test.rb +++ b/test/unit/helpers/projects_helper_test.rb @@ -60,4 +60,9 @@ class ProjectsHelperTest < HelperTestCase def test_format_version_name_for_system_version assert_equal "OnlineStore - Systemwide visible version", format_version_name(Version.find(7)) end + + def test_version_options_for_select_with_no_versions + assert_equal '', version_options_for_select([]) + assert_equal '', version_options_for_select([], Version.find(1)) + end end