]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Checking that get_user_by_username() returned something in ElggUser constructor to...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 14 Apr 2011 00:03:32 +0000 (00:03 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 14 Apr 2011 00:03:32 +0000 (00:03 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8987 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggUser.php

index 5c65a4d662437de2fb7bfa3e3796ed981a83d2ca..1af4cdc3a0516ff288e3502a120f550fa25b1411 100644 (file)
@@ -59,9 +59,11 @@ class ElggUser extends ElggEntity
 
                                // See if this is a username
                        } else if (is_string($guid)) {
-                               $guid = get_user_by_username($guid);
-                               foreach ($guid->attributes as $key => $value) {
-                                       $this->attributes[$key] = $value;
+                               $user = get_user_by_username($guid);
+                               if ($user) {
+                                       foreach ($user->attributes as $key => $value) {
+                                               $this->attributes[$key] = $value;
+                                       }
                                }
 
                                // Is $guid is an ElggUser? Use a copy constructor