trac750 fix for crash when a user logs in and hasn't already posted a notice

This commit is contained in:
Zach Copley 2009-01-23 05:47:34 +00:00
parent df25b5f5f5
commit 36d55526d3

View File

@ -57,29 +57,30 @@ class FacebookhomeAction extends FacebookAction
$this->user = $this->flink->getUser(); $this->user = $this->flink->getUser();
// If this is the first time the user has started the app // If this is the first time the user has started the app
// prompt for Facebook status update permission // prompt for Facebook status update permission
if (!$this->facebook->api_client->users_hasAppPermission('status_update')) { if (!$this->facebook->api_client->users_hasAppPermission('status_update')) {
if ($this->facebook->api_client->data_getUserPreference( if ($this->facebook->api_client->data_getUserPreference(
FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') { FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
$this->getUpdatePermission(); $this->getUpdatePermission();
return; return;
} }
} }
// Make sure the user's profile box has the lastest notice // Make sure the user's profile box has the lastest notice
$notice = $this->user->getCurrentNotice(); $notice = $this->user->getCurrentNotice();
$this->updateProfileBox($notice); if ($notice) {
$this->updateProfileBox($notice);
}
if ($this->arg('status_submit') == 'Send') { if ($this->arg('status_submit') == 'Send') {
$this->saveNewNotice(); $this->saveNewNotice();
} }
// User is authenticated and has already been prompted once for // User is authenticated and has already been prompted once for
// Facebook status update permission? Then show the main page // Facebook status update permission? Then show the main page
// of the app // of the app
$this->showPage(); $this->showPage();
} else { } else {