diff --git a/context.module b/context.module
index 5c0bd5c..0b70fcf 100644
--- a/context.module
+++ b/context.module
@@ -244,7 +244,7 @@ function context_preprocess_menu_link(&$variables) {
         // - Do not add class twice on current page.
         if (in_array($variables['element']['#href'], $reaction_menu_paths) && $variables['element']['#href'] != $_GET['q']) {
           // Do not add the 'active' class twice in views tabs.
-          if (!in_array('active', $variables['element']['#localized_options']['attributes']['class'])) {
+          if (isset($variables['element']['#localized_options']['attributes']['class']) && !in_array('active', $variables['element']['#localized_options']['attributes']['class'])) {
             $variables['element']['#localized_options']['attributes']['class'][] = 'active';
           }
         }
