Skip to content

Commit

Permalink
Check for non-existing duration
Browse files Browse the repository at this point in the history
Default to zero
  • Loading branch information
fabian committed Jan 4, 2025
1 parent ac0e989 commit ecc7b96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Transport/Entity/Schedule/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public static function createFromJson($json, self $obj = null)
$obj->to->platform = $json->legs[count($json->legs) - 2]->exit->track;
}

$obj->duration = gmdate('0z\dH:i:s', $json->duration);
$obj->duration = gmdate('0z\dH:i:s', $json->duration ?? 0);

$numberOfVehicles = 0;
foreach ($json->legs as $leg) {
Expand Down

0 comments on commit ecc7b96

Please sign in to comment.