[Pkg-owncloud-commits] [php-sabre-vobject] 35/43: Handle NoInstancesException in isInTimeRange()

David Prévot taffit at moszumanska.debian.org
Sat Sep 5 15:23:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 4.0.0-alpha2
in repository php-sabre-vobject.

commit 9a48c45f608c74be58fdd8dd9dadd79075153e1b
Author: Dominik Tobschall <dominik at fruux.com>
Date:   Wed Aug 26 14:05:32 2015 +0200

    Handle NoInstancesException in isInTimeRange()
---
 lib/Component/VEvent.php | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/Component/VEvent.php b/lib/Component/VEvent.php
index 3b3c69b..ddc4dab 100644
--- a/lib/Component/VEvent.php
+++ b/lib/Component/VEvent.php
@@ -5,6 +5,7 @@ namespace Sabre\VObject\Component;
 use DateTimeInterface;
 use Sabre\VObject;
 use Sabre\VObject\Recur\EventIterator;
+use Sabre\VObject\Recur\NoInstancesException;
 
 /**
  * VEvent component.
@@ -32,7 +33,19 @@ class VEvent extends VObject\Component {
     function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
 
         if ($this->RRULE) {
-            $it = new EventIterator($this, null, $start->getTimezone());
+
+            try {
+
+                $it = new EventIterator($this, null, $start->getTimezone());
+
+            } catch (NoInstancesException $e) {
+
+                // If we've catched this exception, there are no instances
+                // for the event that fall into the specified time-range.
+                return false;
+
+            }
+
             $it->fastForward($start);
 
             // We fast-forwarded to a spot where the end-time of the

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list