deal when Net::MAC::Vendor-lookup doesn't return an arrayref, RT#39384
authorIvan Kohler <ivan@freeside.biz>
Thu, 10 Dec 2015 00:56:15 +0000 (16:56 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 10 Dec 2015 00:56:15 +0000 (16:56 -0800)
httemplate/view/elements/svc_Common.html
httemplate/view/elements/svc_radius_usage.html

index 771bfb2..2078387 100644 (file)
@@ -283,8 +283,8 @@ my $format_field = sub {
   } elsif ( $type eq 'checkbox' ) {
     $value = $value eq 'Y' ? emt('Yes') : emt('No');
   } elsif ( $type =~ /(input-)?mac_addr/ and $value =~ /\w/) {
-    my $vendor = Net::MAC::Vendor::lookup($value)->[0];
-    $value .= " ($vendor)" if $vendor;
+    my $vendor = Net::MAC::Vendor::lookup($value);
+    $value .= ' ('. $vendor->[0]. ')' if $vendor;
     $value = $m->scomp('/elements/mac_addr.html', $value);
   }
 
index 08d6d53..5a958ee 100644 (file)
 %  ) / 1048576;
 %
 %  my $last_mac = $svc->attribute_last_sqlradacct( 'CallingStationId' );
-%  if ( $last_mac =~ /^\s*(([\dA-F]{2}[\-:]){5}[\dA-F]{2})/i ) {
-%    $last_mac .= ' ('. (Net::MAC::Vendor::lookup($1))->[0]. ')';
+%  if (    $last_mac =~ /^\s*(([\dA-F]{2}[\-:]){5}[\dA-F]{2})/i
+%       && my $vendor = Net::MAC::Vendor::lookup($1)
+%     )
+%  {
+%    $last_mac .= ' ('. $vendor->[0]. ')';
 %  }