Skip to content

Commit

Permalink
Check for stop in timetable.search.ch response
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian committed Oct 10, 2024
1 parent 0737e97 commit 9c8b82f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/Transport/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,12 @@ public function getStationBoard(StationBoardQuery $query)
// send request
$result = $this->sendAndParseQuery($query);

// check for API messages
if (isset($result->messages) && is_array($result->messages)) {
throw new \Exception('Messages from timetable.search.ch: '.implode($result->messages));
if (isset($result->stop)) {
$station = Station::createStationFromJson($result->stop);
} else {
$station = null;
}

$station = Station::createStationFromJson($result->stop);

$journeys = [];

if ($result->connections) {
Expand Down

0 comments on commit 9c8b82f

Please sign in to comment.