Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.280
diff -u -p -r1.280 menu.inc
--- includes/menu.inc	5 Jul 2008 18:30:04 -0000	1.280
+++ includes/menu.inc	8 Jul 2008 20:35:30 -0000
@@ -257,6 +257,12 @@ function menu_get_ancestors($parts) {
   $length =  $number_parts - 1;
   $end = (1 << $number_parts) - 1;
   $masks = variable_get('menu_masks', array());
+  if (empty($masks)) {
+    // An error occured - try to recover for the current page and then rebuild.
+    variable_set('menu_rebuild_needed', TRUE);
+    // Masks for all paths of length 4 parts or less.
+    $masks = array(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
+  }
   // Only examine patterns that actually exist as router items (the masks).
   foreach ($masks as $i) {
     if ($i > $end) {
