- if ($user['nb_mails'] > 0 && $user['notify']) {
- $mail = new PlMailer('emails/broken.mail.tpl');
- $dest = User::getSilentWithUID($user['uid']);
- $mail->setTo($dest);
- $mail->assign('user', $user);
- $mail->assign('email', $email);
- $mail->send();
- } else {
- $profile = Profile::get($user['alias']);
- WatchProfileUpdate::register($profile, 'broken');
- }
+ $userobj = User::getSilentWithUID($user['uid']);
+ }
+ if (is_null($userobj)) {
+ continue;
+ }
+ $profile = $userobj->profile();
+ if (is_null($profile)) {
+ continue;
+ }
+ if ($user['nb_mails'] > 0 && $user['notify']) {
+ $mail = new PlMailer('emails/broken.mail.tpl');
+ $mail->setTo($userobj);
+ $mail->assign('user', $user);
+ $mail->assign('email', $email);
+ $mail->send();
+ } else {
+ WatchProfileUpdate::register($profile, 'broken');
+ }