diff options
author | Zach Copley <zach@status.net> | 2009-11-03 09:55:35 -0800 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2009-11-03 09:55:35 -0800 |
commit | d03a57853e06310228f7df782dd60068863f4a69 (patch) | |
tree | 7682535ba9e6ff45f046ef130220432e178915c5 /lib/api.php | |
parent | 1e6aff69d69e09495638b60831c0548aae0b9773 (diff) |
Don't try to pull up designs for non-existent users
Diffstat (limited to 'lib/api.php')
-rw-r--r-- | lib/api.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/api.php b/lib/api.php index 9bd2083de..a1236ab7e 100644 --- a/lib/api.php +++ b/lib/api.php @@ -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); |