Skip to content

Commit

Permalink
Prevent fatal error if calendar could not be found.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Apr 11, 2015
1 parent 35b99b1 commit e98242b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kronolith/calendars/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@
$notification->push(_("You are not allowed to see this calendar."), 'horde.error');
$default->redirect();
}
$form = new Kronolith_Form_EditCalendar($vars, $calendar);

try {
$form = new Kronolith_Form_EditCalendar($vars, $calendar);
} catch (Horde_Exception_NotFound $e) {
$notification->push(_("The calendar could not be found."), 'horde.error');
$default->redirect();
}

// Execute if the form is valid.
if ($owner && $form->validate($vars)) {
Expand Down
5 changes: 5 additions & 0 deletions kronolith/lib/Form/EditCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public function __construct($vars, $calendar)
Kronolith::ALL_CALENDARS,
$calendar->getName()
);

if (!$calendarObject) {
throw new Horde_Exception_NotFound();
}

$url = $registry->get('webroot', 'horde');
if (isset($conf['urls']['pretty']) &&
$conf['urls']['pretty'] == 'rewrite') {
Expand Down

0 comments on commit e98242b

Please sign in to comment.