diff --git a/src/ContextManager.php b/src/ContextManager.php
index 04e8f98..30a8733 100644
--- a/src/ContextManager.php
+++ b/src/ContextManager.php
@@ -151,7 +151,8 @@ class ContextManager {
    */
   public function getContext($id) {
     $contexts = $this->getContexts();
-    $currentContext = $this->currentRouteMatch->getParameter('context') ? $this->currentRouteMatch->getParameter('context')->id() : '';
+    $currentContext = $this->currentRouteMatch->getParameter('context');
+    $currentContext = ($currentContext instanceof Context) ? $currentContext->id() : '';
     $ids = [];
     if ($id) {
       if (strpos($id, '*') !== FALSE) {
