diff --git a/taxonomy_access.create.inc b/taxonomy_access.create.inc
index 8cef34c..0cdf177 100644
--- a/taxonomy_access.create.inc
+++ b/taxonomy_access.create.inc
@@ -616,10 +616,15 @@ function _taxonomy_access_field_validate($entity_type, $entity, &$errors) {
   $old_fields = FALSE;
 
   // The entity is actually a "pseudo-entity," and the user profile form
-  // neglects to include the uid.  So, load it.
+  // neglects to include the uid. So, we need to load it manually.
   if ($entity_type == 'user') {
-    if ($account = user_load_by_name($entity->name)) {
-      $entity->uid = $account->uid;
+    // The Profile2 module causes validation to happen twice, once for the user
+    // and once for the profile. In the second case, the entity is not actually
+    // a proper user entity. So, check if the name exists.
+    if (isset($entity->name)) {
+      if ($account = user_load_by_name($entity->name)) {
+        $entity->uid = $account->uid;
+      }
     }
   }
 
