Skip to content

Commit

Permalink
Perform this check in the handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Mar 18, 2015
1 parent e4dde89 commit 4e77e27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions kronolith/lib/Api.php
Expand Up @@ -808,10 +808,6 @@ public function import($content, $contentType, $calendar = null)
$iCal->addComponent($content);
}

$components = $iCal->getComponents();
if (count($components) == 0) {
throw new Kronolith_Exception(_("No iCalendar data was found."));
}
$ical_importer = new Kronolith_Icalendar_Handler_Base($ical, $kronolith_driver);
return $ical_importer->process();

Expand Down
7 changes: 6 additions & 1 deletion kronolith/lib/Icalendar/Handler/Base.php
Expand Up @@ -68,11 +68,16 @@ public function process()
* Process the iCalendar data.
*
* @return array A hash of UID => id.
* @throws Kronolith_Exception
*/
protected function _process()
{
$ids = array();
foreach ($this->_iCal->getComponents() as $component) {
$components = $this->_iCal->getComponents();
if (count($components) == 0) {
throw new Kronolith_Exception(_("No iCalendar data was found."));
}
foreach ($components as $component) {
if (!$this->_preSave($component)) {
continue;
}
Expand Down

0 comments on commit 4e77e27

Please sign in to comment.