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

index d7a1dcf..296c27b 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 899e6aa..3d4e1bb 100644 (file)
@@ -63,7 +63,8 @@
             <% $td %><% $device->part_device->devicename |h %></TD>
 %         }
           <% $td %><% $device->mac_addr_pretty %>
-                 (<% (Net::MAC::Vendor::lookup($device->mac_addr_formatted('U',':')))->[0] %>)
+%                my $vendor = Net::MAC::Vendor::lookup($device->mac_addr_formatted('U',':'));
+                 (<% $vendor ? $vendor->[0] : '' %>)
           </TD>
           <% $td %><% $export_links %></TD>
           <% $td %>(
index 4719691..5619852 100644 (file)
 %  ) / 1073741824;
 %
 %  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]. ')';
 %  }