$filehandler->setFilename("profile/" . $user->getGUID() . $size . ".jpg");
$success = false;
-if ($filehandler->open("read")) {
- if ($contents = $filehandler->read($filehandler->size())) {
- $success = true;
+
+try {
+ if ($filehandler->open("read")) {
+ if ($contents = $filehandler->read($filehandler->size())) {
+ $success = true;
+ }
}
+} catch (InvalidParameterException $e) {
+ elgg_log("Unable to get profile icon for user with GUID $entity->guid", 'ERROR');
}
+
if (!$success) {
$url = "_graphics/icons/user/default{$size}.gif";
$url = elgg_normalize_url($url);