From bb74b56fc4f16357332b5e7e986b5403a93e1e99 Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Tue, 1 Nov 2016 15:32:53 +0100 Subject: [PATCH] Armored getContextPath() --- lib/Shell.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Shell.php b/lib/Shell.php index bd4157f..86c7e4a 100644 --- a/lib/Shell.php +++ b/lib/Shell.php @@ -60,10 +60,17 @@ class Shell public function getContextPath($separator=":") { + // Return null if we don't have a current context + if (!$this->context) + return null; + + // Assemble the contexts to walk $stack = [ $this->context->getName() ]; foreach ($this->contextStack as $context) { $stack[] = $context->getName(); } + + // Reverse the order to make it more logical $stack = array_reverse($stack); return join($separator,$stack); }