diff --git a/pathauto.module b/pathauto.module index 7f45236..4fe7441 100644 --- a/pathauto.module +++ b/pathauto.module @@ -365,14 +365,22 @@ function pathauto_entity_load($entities, $type) { static $drupal_static_fast; if (!isset($drupal_static_fast)) { - $drupal_static_fast = &drupal_static(__FUNCTION__); + $drupal_static_fast['types'] = &drupal_static(__FUNCTION__); } - $path_auto_entity_types = &$drupal_static_fast; + $path_auto_entity_types = &$drupal_static_fast['types']; - // Save the entity types used statically to avoid unnessasary queries later. + // Save the entity types used statically to avoid unnecessary queries later. if (!isset($path_auto_entity_types)) { - $path_auto_entity_types = db_query("SELECT entity_type FROM {pathauto_state} GROUP BY entity_type")->fetchAllKeyed(0, 0); + try { + $path_auto_entity_types = db_query("SELECT entity_type FROM {pathauto_state} GROUP BY entity_type")->fetchAllKeyed(0, 0); + } + catch (PDOException $e) { + if ($e->getCode() === '42S02') { + watchdog('pathauto', 'The pathauto_state table was not found. Be sure that all database updates have been run.', array(), WATCHDOG_ALERT); + return; + } + } } // We aren't storing state for this type at the moment.