Fix null pointer dereference when sending a mail to validate the subscription to...
authorNicolas Iooss <nicolas.iooss_git@polytechnique.org>
Wed, 6 Nov 2013 22:49:17 +0000 (23:49 +0100)
committerNicolas Iooss <nicolas.iooss_git@polytechnique.org>
Wed, 6 Nov 2013 22:52:11 +0000 (23:52 +0100)
Fix this error: PHP Fatal error:  Call to a member function bestEmail() on a non-object

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
modules/xnetgrp.php

index 051b0da..744e4e0 100644 (file)
@@ -831,9 +831,13 @@ class XnetGrpModule extends PLModule
                          S::i('uid'), $globals->asso('id'));
             $admins = $globals->asso()->iterToNotify();
             $admin = $admins->next();
-            $to = $admin->bestEmail();
-            while ($admin = $admins->next()) {
-                $to .= ', ' . $admin->bestEmail();
+            if (!is_null($admin)) {
+                $to = $admin->bestEmail();
+                while ($admin = $admins->next()) {
+                    $to .= ', ' . $admin->bestEmail();
+                }
+            } else {
+                $to = '';
             }
 
             $append = "\n"