From: Michael J. Rubinsky Date: Tue, 18 Aug 2009 16:19:30 +0000 (-0400) Subject: Check for cases where resource is not found X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=4418d5928d589b01336504e9c3db5aae52f11013;p=horde.git Check for cases where resource is not found --- diff --git a/kronolith/lib/Driver/Sql.php b/kronolith/lib/Driver/Sql.php index 8e77e7eb8..25a3999c7 100644 --- a/kronolith/lib/Driver/Sql.php +++ b/kronolith/lib/Driver/Sql.php @@ -804,7 +804,11 @@ class Kronolith_Driver_Sql extends Kronolith_Driver if ($results instanceof PEAR_Error) { throw new Horde_Exception($results->getMessage()); } + if (empty($results)) { + throw new Horde_Exception('Resource not found'); + } $return = array(); + var_dump($results); foreach ($results as $field => $value) { $return[str_replace('resource_', '', $field)] = $this->convertFromDriver($value); } diff --git a/kronolith/resources.php b/kronolith/resources.php index be3c901fc..e15ba9a5b 100644 --- a/kronolith/resources.php +++ b/kronolith/resources.php @@ -17,4 +17,4 @@ $new = array('name' => _("N329SP"), //var_dump($results); /* Test adding resource to event */ -var_dump(Kronolith_Resource::getResource(5)); \ No newline at end of file +var_dump(Kronolith_Resource::getResource(6)); \ No newline at end of file