Index: project.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/project.module,v
retrieving revision 1.292
diff -u -F^f -r1.292 project.module
--- project.module	24 Aug 2007 04:31:30 -0000	1.292
+++ project.module	25 Aug 2007 18:26:07 -0000
@@ -530,6 +530,10 @@ function project_page_overview($termname
     if ($termname) {
 
       $type = db_fetch_object(db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE t.vid = %d AND t.name = '%s'", 't', 'tid'), $vid, $termname));
+      // Bad project category passed, return page not found.
+      if (!$type) {
+        return drupal_not_found();
+      }
       if (!$sort_method) {
         // For the default, we use the overall default if enabled for this term, and if not we use the first enabled method.
         $term_methods = array_filter(variable_get('project_sort_method_used_' . $type->tid, array_keys($sort_methods)));
@@ -541,6 +545,10 @@ function project_page_overview($termname
       }
 
       $module = $sort_methods[$sort_method];
+      // Bad sort method passed, return page not found.
+      if (!isset($module)) {
+        return drupal_not_found();
+      }
       if (module_invoke($module, 'project_sort_methods', 'set term', $sort_method)) {
         $tree = taxonomy_get_tree(_project_get_vid(), $type->tid);
         $terms = array();
@@ -584,8 +592,12 @@ function project_page_overview($termname
           }
         }
 
-        if (arg(3) && is_numeric(arg(3))) {
-          $term = taxonomy_get_term(arg(3));
+        // Look for a specific category term.
+        if ($arg = arg(3)) {
+          // Bad term, return page not found.
+          if (!($term = taxonomy_get_term($arg))) {
+            return drupal_not_found();
+          }
         }
       }
 
@@ -761,6 +773,10 @@ function project_page_overview($termname
   }
   // If taxonomy is not enabled, fetch all projects
   else {
+    // Any terms passed without taxonomy are bogus -- return page not found.
+    if (isset($termname)) {
+      return drupal_not_found();
+    }
     // If the site has enabled issue tracking via the project_issue
     // module, we want to add 1 more field and JOIN to our query so
     // we can provide the link for "Bugs and feature requests"...
