From 03b88d1da32db4c188364295ea009ba04193495a Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 9 Feb 2011 22:35:00 -0800 Subject: [PATCH] Don't throw when a user saves account settings without changing their profile picture. Summary: Going to Settings -> Account and hitting "Save" without selecting a file in the file dialog currently throws. Test Plan: Went to Settings -> Account and hit "Save" without making changes. No exception. Then uploaded a picture normally. Differential Revision: 30 Reviewed By: tomo Reviewers: tomo --- .../settings/PhabricatorUserSettingsController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/applications/people/controller/settings/PhabricatorUserSettingsController.php b/src/applications/people/controller/settings/PhabricatorUserSettingsController.php index 6b013f056f..941bf55e3c 100644 --- a/src/applications/people/controller/settings/PhabricatorUserSettingsController.php +++ b/src/applications/people/controller/settings/PhabricatorUserSettingsController.php @@ -73,8 +73,11 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController { ->setURI('/settings/page/arcanist/?regenerated=true'); case 'account': if (!empty($_FILES['profile'])) { - $file = PhabricatorFile::newFromPHPUpload($_FILES['profile']); - $user->setProfileImagePHID($file->getPHID()); + $err = idx($_FILES['profile'], 'error'); + if ($err != UPLOAD_ERR_NO_FILE) { + $file = PhabricatorFile::newFromPHPUpload($_FILES['profile']); + $user->setProfileImagePHID($file->getPHID()); + } } $user->save();