]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Don't try to pull up designs for non-existent users
authorZach Copley <zach@status.net>
Tue, 3 Nov 2009 17:55:35 +0000 (09:55 -0800)
committerZach Copley <zach@status.net>
Tue, 3 Nov 2009 17:55:35 +0000 (09:55 -0800)
lib/api.php

index 9bd2083deba20912fad009c10d91c5d69b096a8c..a1236ab7ec7176e146070edf2407bd60ef64dc67 100644 (file)
@@ -134,11 +134,20 @@ class ApiAction extends Action
         $twitter_user['protected'] = false; # not supported by StatusNet yet
         $twitter_user['followers_count'] = $profile->subscriberCount();
 
-        // Need to pull up the user for some of this
-        $user = $profile->getUser();
-        $design = $user->getDesign();
         $defaultDesign = Design::siteDesign();
-        if (!$design) $design = $defaultDesign;
+        $design        = null;
+        $user          = $profile->getUser();
+
+        // Note: some profiles don't have an associated user
+
+        if (!empty($user)) {
+            $design = $user->getDesign();
+        }
+
+        if (empty($design)) {
+            $design = $defaultDesign;
+        }
+
         $color = Design::toWebColor(empty($design->backgroundcolor) ? $defaultDesign->backgroundcolor : $design->backgroundcolor);
         $twitter_user['profile_background_color'] = ($color == null) ? '' : '#'.$color->hexValue();
         $color = Design::toWebColor(empty($design->textcolor) ? $defaultDesign->textcolor : $design->textcolor);