commit 1ca533ba49c51e6f4ef1d540a1110d1ef823f2ef
Author: Damien Tournoud <damien@commerceguys.com>
Date:   Fri Feb 3 13:44:29 2012 +0100

    Issue #1345340: Make the base selection handler more robust to missing entity types.

diff --git a/plugins/selection/EntityReference_SelectionHandler_Generic.class.php b/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
index 58a4df7..b99ce33 100644
--- a/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
+++ b/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
@@ -13,6 +13,13 @@ class EntityReference_SelectionHandler_Generic implements EntityReference_Select
    */
   public static function getInstance($field, $instance) {
     $entity_type = $field['settings']['target_type'];
+
+    // Check if the entity type does exist and has a base table.
+    $entity_info = entity_get_info($entity_type);
+    if (empty($entity_info['base table'])) {
+      return EntityReference_SelectionHandler_Broken::getInstance($field, $instance);
+    }
+
     if (class_exists($class_name = 'EntityReference_SelectionHandler_Generic_' . $entity_type)) {
       return new $class_name($field, $instance);
     }
