ios12PickSwitchportCommand: fix undefined key
authorAlexey Andriyanov <alan@al-an.info>
Tue, 24 Apr 2018 13:40:39 +0000 (16:40 +0300)
committerAlexey Andriyanov <alan@al-an.info>
Tue, 24 Apr 2018 13:49:01 +0000 (16:49 +0300)
Warnings were emitted when no switched ports found.

wwwroot/inc/deviceconfig.php

index 1569b83..519501d 100644 (file)
@@ -397,7 +397,7 @@ function ios12PickSwitchportCommand (&$work, $line)
                $work['portconfig'][$port_name][] = array ('type' => 'line-header', 'line' => $line);
 
                // save work, if it makes sense
-               if (! in_array ($port_name, $work['switchports']))
+               if (! isset ($work['switchports']) || ! in_array ($port_name, $work['switchports']))
                        $work['current']['mode'] = 'SKIP'; // skip not switched ports
                else
                {