diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-05-08 07:12:54 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-05-08 07:12:54 +0200 |
commit | 022465d2a707e6752eca72be795363b06bffb1b3 (patch) | |
tree | c6c43c85797908382b15de536f4f6309caf656e8 /lib | |
parent | ef77bfcdea496576498557e285d01dc4b633c8cb (diff) |
Fix division by zero when calculating journey completion1.1.9
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Travelynx.pm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 51fe1a2..59d03a9 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -1638,8 +1638,11 @@ sub startup { = $ret->{real_arrival}->epoch - $now->epoch; $ret->{journey_duration} = $ret->{real_arrival}->epoch - $ret->{real_departure}->epoch; - $ret->{journey_completion} = 1 - ( - $ret->{arrival_countdown} / $ret->{journey_duration} ); + $ret->{journey_completion} + = $ret->{journey_duration} + ? 1 + - ( $ret->{arrival_countdown} / $ret->{journey_duration} ) + : 1; if ( $ret->{journey_completion} > 1 ) { $ret->{journey_completion} = 1; } |