diff --git a/library/Icinga/Cli/Loader.php b/library/Icinga/Cli/Loader.php index 93b8739c8..5e63f3fe6 100644 --- a/library/Icinga/Cli/Loader.php +++ b/library/Icinga/Cli/Loader.php @@ -251,6 +251,7 @@ class Loader return false; } + $obj = null; try { if ($this->moduleName) { $this->app->getModuleManager()->loadModule($this->moduleName); @@ -267,7 +268,7 @@ class Loader $obj->init(); return $obj->{$this->actionName . 'Action'}(); } catch (Exception $e) { - if ($obj && $obj instanceof Command && $obj->showTrace()) { + if ($obj instanceof Command && $obj->showTrace()) { fwrite(STDERR, $this->formatTrace($e->getTrace())); }