#
# old_revision [f82fb323220b275d3dc05b3c34d5fca44248eb46]
#
# patch "pf/lib/pf/SNMP/Cisco.pm"
#  from [629111f8e99f81b7c824341c4a569f4e18406375]
#    to [b6eed740c943fecaeec3d055e1a5fb6737f42799]
#
============================================================
--- pf/lib/pf/SNMP/Cisco.pm	629111f8e99f81b7c824341c4a569f4e18406375
+++ pf/lib/pf/SNMP/Cisco.pm	b6eed740c943fecaeec3d055e1a5fb6737f42799
@@ -374,8 +374,6 @@ sub getVoiceVlan {
     }
 }
 
-# TODO: if ifIndex doesn't exist, an error should be given
-# to reproduce: bin/pfcmd_vlan -getVlan -ifIndex 999 -switch <ip>
 sub getVlan {
     my ( $this, $ifIndex ) = @_;
     my $logger = Log::Log4perl::get_logger( ref($this) );
@@ -401,7 +399,15 @@ sub getVlan {
         );
         my $result = $this->{_sessionRead}->get_request(
             -varbindlist => ["$OID_vlanTrunkPortNativeVlan.$ifIndex"] );
-        return $result->{"$OID_vlanTrunkPortNativeVlan.$ifIndex"};
+        
+        if (!$result) {
+            $logger->trace(
+                "SNMP get_vlanTrunkNativeVlan failed for ifIndex $ifIndex, the ifIndex is probably invalid"
+            );
+            return 0;
+        }
+        
+        return  $result->{"$OID_vlanTrunkPortNativeVlan.$ifIndex"};
     }
 }
