From 750b19f3e847d8c32ff4e2ea15f1246cce111c67 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Wed, 16 Oct 2019 21:18:17 +0000 Subject: [PATCH] Fix issue when non-existent plugin is enabled (#10699) --- LibreNMS/Plugins.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/LibreNMS/Plugins.php b/LibreNMS/Plugins.php index b440e87a9f..a094323ffc 100644 --- a/LibreNMS/Plugins.php +++ b/LibreNMS/Plugins.php @@ -104,12 +104,14 @@ class Plugins chdir(Config::get('install_dir') . '/html'); $plugin = self::getInstance($file, $pluginName); - $class = get_class($plugin); - $hooks = get_class_methods($class); + if (!is_null($plugin)) { + $class = get_class($plugin); + $hooks = get_class_methods($class); - foreach ((array)$hooks as $hookName) { - if ($hookName[0] != '_') { - self::$plugins[$hookName][] = $class; + foreach ((array)$hooks as $hookName) { + if ($hookName[0] != '_') { + self::$plugins[$hookName][] = $class; + } } }