Don't trigger an exception if there are just no images
authorChuck Hagenbuch <chuck@horde.org>
Fri, 20 Aug 2010 04:49:54 +0000 (00:49 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Fri, 20 Aug 2010 04:49:54 +0000 (00:49 -0400)
ansel/lib/GalleryMode/Date.php

index ba7b2fe..d249539 100644 (file)
@@ -287,8 +287,12 @@ class Ansel_GalleryMode_Date extends Ansel_GalleryMode_Base
             if (!empty($gallery_where)) {
                 $where .= ' AND ' . $gallery_where;
             }
-            $images= $ansel_storage->listImages($this->_gallery->id, $from, $to, 'image_id', $where, 'image_sort');
-            $results = $ansel_storage->getImages(array('ids' => $images, 'preserve' => true));
+            $images = $ansel_storage->listImages($this->_gallery->id, $from, $to, 'image_id', $where, 'image_sort');
+            if ($images) {
+                $results = $ansel_storage->getImages(array('ids' => $images, 'preserve' => true));
+            } else {
+                $results = array();
+            }
 
             if ($this->_gallery->get('has_subgalleries')) {
                 $images = array();