summaryrefslogtreecommitdiff
path: root/lib/Travelynx.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-xlib/Travelynx.pm7
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;
}