Patch #820

NoMethodError in SearchController

Added by Angel Dobbs-Sciortino 117 days ago. Updated 114 days ago.

Status:Closed Start:2008-03-10
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:Search engine
Target version:0.7

Description

Submitting an invalid project id to a search results in a NoMethodError from a nil object.

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.active?

app/controllers/application.rb:105:in `check_project_privacy'
app/controllers/search_controller.rb:41:in `index'

This patch checks whether the project exists first, and a 404 page is displayed instead. Test included.

fix_NoMethodError_in_SearchController.diff (1.8 KB) Angel Dobbs-Sciortino, 2008-03-10 00:20

Associated revisions

Revision 1237
Added by jplang 114 days ago

Fixes #820: invalid project id causes a NoMethodError in SearchController (Angel Dobbs-Sciortino).

History

2008-03-10 02:29 - Angel Dobbs-Sciortino

Applies cleanly to r1212.

2008-03-12 21:51 - Jean-Philippe Lang

  • Category set to Search engine
  • Status changed from New to Closed
  • Target version set to 0.7

Patch applied with slight changes in r1237 (used a before_filter instead).
Thanks

Also available in: Atom PDF