From 4418d5928d589b01336504e9c3db5aae52f11013 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Tue, 18 Aug 2009 12:19:30 -0400 Subject: [PATCH] Check for cases where resource is not found --- kronolith/lib/Driver/Sql.php | 4 ++++ kronolith/resources.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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 -- 2.11.0