MFB: Catch errors, at least until these throw exceptions
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 17 Feb 2010 15:15:35 +0000 (10:15 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 17 Feb 2010 15:16:24 +0000 (10:16 -0500)
turba/lib/View/Browse.php

index 262b01d..8a7edfe 100644 (file)
@@ -239,6 +239,10 @@ class Turba_View_Browse {
                         break;
                     }
                     $targetDriver = Turba_Driver::singleton($targetSource);
+                    if ($targetDriver instanceof PEAR_Error) {
+                        $notification->push(sprintf_("Could not load driver for %s", $targetSource), 'horde.error');
+                        break;
+                    }
                     $target = &$targetDriver->getObject($targetKey);
                     if (is_a($target, 'PEAR_Error')) {
                         $notification->push($target, 'horde.error');
@@ -247,6 +251,10 @@ class Turba_View_Browse {
                 } else {
                     $targetSource = $vars->get('targetAddressbook');
                     $targetDriver = Turba_Driver::singleton($targetSource);
+                    if ($targetDriver instanceof PEAR_Error) {
+                        $notification->push(sprintf_("Could not load driver for %s", $targetSource), 'horde.error');
+                        break;
+                    }
                 }
                 if (!empty($target) && $target->isGroup()) {
                     // Adding contact to an existing list.