Fix exception on middleware loader

An exception was thrown when loading middleware if a requested controller is from a disabled plugin, as the `getRequestedController` method returns a Response object in this scenario.

Hat tip to @w20k.
This commit is contained in:
Ben Thomson 2019-08-12 22:16:34 +08:00
parent 9b8974b003
commit f190f7a347
No known key found for this signature in database
GPG Key ID: BD1BF04E944DBD80
1 changed files with 5 additions and 1 deletions

View File

@ -77,7 +77,11 @@ class BackendController extends ControllerBase
$path = implode('/', $pathParts);
$requestedController = $this->getRequestedController($path);
if (!is_null($requestedController) && count($requestedController['controller']->getMiddleware())) {
if (
!is_null($requestedController)
&& is_array($requestedController)
&& count($requestedController['controller']->getMiddleware())
) {
$action = $requestedController['action'];
// Collect applicable middleware and insert middleware into pipeline