]> source.dussan.org Git - redmine.git/commitdiff
Fix nil method error when no issue params are submitted. #5123
authorEric Davis <edavis@littlestreamsoftware.com>
Sun, 20 Jun 2010 03:24:38 +0000 (03:24 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Sun, 20 Jun 2010 03:24:38 +0000 (03:24 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3796 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
test/functional/issues_controller_test.rb

index 2a60c3616489bc5da2312e6606d642a879523050..b0db5c80031b1a528739b4c1326dc26b108d0375 100644 (file)
@@ -149,7 +149,7 @@ class IssuesController < ApplicationController
     if request.get? || request.xhr?
       @issue.start_date ||= Date.today
     else
-      requested_status = IssueStatus.find_by_id(params[:issue][:status_id])
+      requested_status = IssueStatus.find_by_id(params[:issue][:status_id]) if params[:issue]
       # Check that the user is allowed to apply the requested status
       @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status
       call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
index 532d13e2d7ac7f9499675da1d15a3067362635cb..89b22605368b0d478855fc27b4470f336c3d33ad 100644 (file)
@@ -649,6 +649,12 @@ class IssuesControllerTest < ActionController::TestCase
                                         :value => 'Value for field 2'}
   end
   
+  test "POST new with no issue params" do
+    @request.session[:user_id] = 2
+    post :new, :project_id => 1
+    assert_response :success
+  end
+
   def test_copy_routing
     assert_routing(
       {:method => :get, :path => '/projects/world_domination/issues/567/copy'},