diff --git a/entityreference_prepopulate.module b/entityreference_prepopulate.module
index 2747ee4..bf3de61 100644
--- a/entityreference_prepopulate.module
+++ b/entityreference_prepopulate.module
@@ -277,7 +277,8 @@ function entityreference_prepopulate_get_values_from_url($field, $instance, $fla
 
   // Check if the IDs are valid, and get filter out the ones that are not valid.
   $handler = entityreference_get_selection_handler($field, $instance);
-  if (!$ids = $handler->validateReferencableEntities($ids)) {
+  if (empty($ids) || !$ids = $handler->validateReferencableEntities($ids)) {
+    $cache[$identifier] = FALSE;
     return;
   }
 
