From 045826bef9f440938549383f2410dba978626608 Mon Sep 17 00:00:00 2001
From: M Parker <mparker17@536298.no-reply.drupal.org>
Date: Fri, 2 Jun 2017 14:41:19 -0400
Subject: [PATCH] 2837833-9

---
 src/Entity/PageAccess.php | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/Entity/PageAccess.php b/src/Entity/PageAccess.php
index faac645..c0e79b8 100644
--- a/src/Entity/PageAccess.php
+++ b/src/Entity/PageAccess.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\page_manager\Entity;
 
+use Drupal\Component\Plugin\Exception\ContextException;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Condition\ConditionAccessResolverTrait;
 use Drupal\Core\Entity\EntityAccessControlHandler;
@@ -78,8 +79,17 @@ class PageAccess extends EntityAccessControlHandler implements EntityHandlerInte
       $conditions = $entity->getAccessConditions();
       foreach ($conditions as $condition) {
         if ($condition instanceof ContextAwarePluginInterface) {
+          try {
+            $this->contextHandler()->applyContextMapping($condition, $contexts);
+          }
+          catch (ContextException $e) {
+            return parent::checkAccess($entity, $operation, $account);
+          }
           $this->contextHandler()->applyContextMapping($condition, $contexts);
         }
+        else {
+          return parent::checkAccess($entity, $operation, $account);
+        }
       }
       return AccessResult::allowedIf($this->resolveConditions($conditions, $entity->getAccessLogic()));
     }
-- 
2.13.0

