From 5192d997ded949df5fd81ff40f9a193ba806dc3b Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Tue, 27 Aug 2024 19:06:19 +0200 Subject: [PATCH] get_travel_distance: intermediate: Handle destination renames in sanity check Also related to #160 --- lib/Travelynx/Model/Journeys.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm index 79bc322..343d680 100755 --- a/lib/Travelynx/Model/Journeys.pm +++ b/lib/Travelynx/Model/Journeys.pm @@ -1199,7 +1199,12 @@ sub get_travel_distance { = before_incl { ( $_->[1] and $_->[1] == $to_eva ) or $_->[0] eq $to } @route; - if ( @route < 2 or $route[-1][0] ne $to ) { + if ( + @route < 2 + or ( $route[-1][0] ne $to + and ( not $route[-1][1] or $route[-1][1] != $to_eva ) ) + ) + { # I AM ERROR return ( 0, 0, $distance_beeline );