- my $chan = $channels[$index];
- printf "ch%d (%s) %s (%s)",
- $index, $chan->{'id'}, $type, $wantreply eq "yes" ? "reply" : "noreply";
- push @{$chan->{'requests_'.$direction}}, [$seq, $type] if $wantreply;
+ my $chan;
+ if (!defined $index) {
+ printf "UNKNOWN_CHANNEL (%s) %s (%s)", $rid,
+ $type, $wantreply eq "yes" ? "reply" : "noreply";
+ } else {
+ $chan = $channels[$index];
+ printf "ch%d (%s) %s (%s)", $index, $chan->{'id'},
+ $type, $wantreply eq "yes" ? "reply" : "noreply";
+ push @{$chan->{'requests_'.$direction}}, [$seq, $type]
+ if $wantreply eq "yes";
+ }