From f7ca6d1fa1a536caaff8b6ac19670bb517df416c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Mare=C5=A1?= Date: Fri, 21 Nov 2025 22:06:41 +0100 Subject: [PATCH] show-switch: Better error handling --- show-switch | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/show-switch b/show-switch index 9dab19c..1079000 100755 --- a/show-switch +++ b/show-switch @@ -155,7 +155,12 @@ my $port_table = my_get_table({ print "# Switch ports:\n", Dumper($port_table) if $debug; for my $port (keys %$port_table) { - my $if = $if_table->{$port_table->{$port}->{ifindex}} or die "Port table refers to unknown iface"; + my $ifi = $port_table->{$port}->{ifindex}; + my $if = $if_table->{$ifi}; + if (!$if) { + print STDERR "WARNING: Port $port refers to unknown ifindex $ifi\n"; + next; + } $if->{switch_port} = $port; } -- 2.47.3