From b990b22a4d82a6da5b37afbd356b1755c1230364 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 25 Aug 2024 19:30:34 +0200 Subject: add_message: handle messages where code or text are undef --- lib/Travel/Routing/DE/HAFAS.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/Travel/Routing/DE/HAFAS.pm') diff --git a/lib/Travel/Routing/DE/HAFAS.pm b/lib/Travel/Routing/DE/HAFAS.pm index 53fbb46..584a3a3 100644 --- a/lib/Travel/Routing/DE/HAFAS.pm +++ b/lib/Travel/Routing/DE/HAFAS.pm @@ -425,7 +425,15 @@ sub add_message { } for my $message ( @{ $self->{messages} } ) { - if ( $code eq $message->{code} and $text eq $message->{text} ) { + if ( + ( + not( not defined $code or not defined $message->{code} ) + or $code eq $message->{code} + ) + and ( not( not defined $text or not defined $message->{text} ) + or $text eq $message->{text} ) + ) + { $message->{ref_count}++; return $message; } -- cgit v1.2.3