Check for the presence of a RootControllerDelegate before calling it.
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 31 Mar 2014 13:16:26 +0000 (09:16 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 31 Mar 2014 13:16:26 +0000 (09:16 -0400)
http/root_controller.php

index f24b1f9bcf56377936398b38117563e941b4ee28..75a25d7dcd85ccf7ade032776fc683684f42d428 100644 (file)
@@ -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);
   }
 
   /*!