Skip to content

Commit

Permalink
fail gracefully on missing schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
MaZderMind committed Dec 21, 2016
1 parent 97428d6 commit 4d7e373
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions model/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public function getScale() {

private function fetchSchedule()
{
$schedule = file_get_contents($this->getScheduleCache());
$schedule = @file_get_contents($this->getScheduleCache());

if(!$schedule)
throw new ScheduleException("Error Loading Schedule from ".$this->getScheduleCache());
return null;

return simplexml_load_string($schedule);
}
Expand All @@ -49,6 +49,11 @@ public function getSchedule()
// download schedule-xml
$schedule = $this->fetchSchedule();

// not failing gracefully here will result in a broken page in case
// no schedule is present
if(!$schedule)
return [];

$mapping = $this->getScheduleToRoomSlugMapping();
$program = array();

Expand Down

0 comments on commit 4d7e373

Please sign in to comment.