Better check for valid resource
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 23 Sep 2009 17:13:40 +0000 (13:13 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 29 Sep 2009 20:53:57 +0000 (16:53 -0400)
kronolith/lib/Driver/Resource.php

index 2bdf22a..2168911 100644 (file)
@@ -389,10 +389,13 @@ class Kronolith_Driver_Resource extends Kronolith_Driver_Sql
      * calendar.
      *
      * @param Kronolith_Resource $resource  The kronolith resource to remove
+     *
+     * @return boolean
+     * @throws Horde_Exception
      */
     public function delete($resource)
     {
-        if (!$resource->get('calendar') || !$resource->getId()) {
+        if (!($resource instanceof Kronolith_Resource_Base) || !$resource->getId()) {
             throw new Horde_Exception(_("Resource not valid."));
         }