summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-08-26 16:42:13 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-08-26 16:42:13 +0200
commit407c2a34ed319ba97b8771959b60b0154cee24df (patch)
tree646cc9b1f427a15558878979a3533a55a7e457fe /bin
parent42e9b67f1667022d3eafb33f44d5c7e6f16246cf (diff)
hafas: handle undefined message components
Diffstat (limited to 'bin')
-rwxr-xr-xbin/hafas17
1 files changed, 13 insertions, 4 deletions
diff --git a/bin/hafas b/bin/hafas
index 027b67c..543579a 100755
--- a/bin/hafas
+++ b/bin/hafas
@@ -273,7 +273,12 @@ sub format_delay {
sub show_message {
my ($msg) = @_;
- if ( $verbosity >= ( $min_verbosity{ $msg->type } // 0 ) ) {
+ if (
+ $msg->text
+ and ( not $msg->type
+ or $verbosity >= ( $min_verbosity{ $msg->type } // 0 ) )
+ )
+ {
if ( $msg->short ) {
printf( "| %s\n", $msg->short );
}
@@ -451,9 +456,13 @@ for my $res ( $hafas->connections ) {
printf("\n???\n");
}
for my $msg ( $sec->messages ) {
- if ( $msg->code eq 'text.connection.section.arrival.date.deviation'
- or $msg->code eq
- 'text.connection.section.departure.date.deviation' )
+ if (
+ $msg->code
+ and ( $msg->code eq
+ 'text.connection.section.arrival.date.deviation'
+ or $msg->code eq
+ 'text.connection.section.departure.date.deviation' )
+ )
{
next;
}