Don't render the issue form if issue.project is nil (#19276).

git-svn-id: http://svn.redmine.org/redmine/trunk@14146 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2015-03-20 16:27:09 +00:00
parent 98c28b467b
commit ea099fb771
2 changed files with 8 additions and 2 deletions

View File

@ -151,7 +151,13 @@ class IssuesController < ApplicationController
return
else
respond_to do |format|
format.html { render :action => 'new' }
format.html {
if @issue.project.nil?
render_error :status => 422
else
render :action => 'new'
end
}
format.api { render_validation_errors(@issue) }
end
end

View File

@ -2218,7 +2218,7 @@ class IssuesControllerTest < ActionController::TestCase
:issue => {:project_id => 3,
:tracker_id => 2,
:subject => 'Foo'}
assert_response 403
assert_response 422
end
end