From 9730b0f2489a9cba8950cdcb37ef65509f3ba1a0 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 31 Mar 2014 09:16:26 -0400 Subject: [PATCH] Check for the presence of a RootControllerDelegate before calling it. --- http/root_controller.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/http/root_controller.php b/http/root_controller.php index f24b1f9..75a25d7 100644 --- a/http/root_controller.php +++ b/http/root_controller.php @@ -80,7 +80,7 @@ class RootController } public function delegate() { - return $this->delegate->Get(); + return $this->delegate; } /*! @@ -113,7 +113,8 @@ class RootController // Register self as the active instance. $GLOBALS[__CLASS__] = $this; - $this->delegate->OnInitialRequest($this->request, $this->response); + if ($this->delegate) + $this->delegate->OnInitialRequest($this->request, $this->response); // Dispatch the request to an Action. $this->RouteRequest($this->request); @@ -129,7 +130,8 @@ class RootController */ public function Stop() { - $this->delegate->WillStop($this->request, $this->response); + if ($this->delegate) + $this->delegate->WillStop($this->request, $this->response); $this->output_filter->FilterOutput($this->request, $this->response); $this->_Exit(); } @@ -170,7 +172,8 @@ class RootController */ public function RouteRequest(Request $request) { - $this->delegate->WillRouteRequest($request, $this->response); + if ($this->delegate) + $this->delegate->WillRouteRequest($request, $this->response); $url_map_value = $this->url_map->Evaluate($request); @@ -193,13 +196,15 @@ class RootController */ public function InvokeAction(Action $action) { - $this->delegate->WillInvokeAction($action, $this->request, $this->response); + if ($this->delegate) + $this->delegate->WillInvokeAction($action, $this->request, $this->response); $action->FilterRequest($this->request, $this->response); $action->Invoke($this->request, $this->response); $action->FilterResponse($this->request, $this->response); - $this->delegate->DidInvokeAction($action, $this->request, $this->response); + if ($this->delegate) + $this->delegate->DidInvokeAction($action, $this->request, $this->response); } /*! -- 2.43.5