diff --git a/includes/plugins.inc b/includes/plugins.inc index 35ba65d5818c1b27f58d89e144703f712778983c..442d69390944700e8c15aab7e76348edcf3046ae 100644 --- a/includes/plugins.inc +++ b/includes/plugins.inc @@ -1120,9 +1120,11 @@ function panels_context_create_empty($type) { */ function panels_context_get_keywords($contexts) { $keywords = array(); - foreach ($contexts as $id => $context) { - if ($keyword = $context->get_keyword()) { - $keywords["%$keyword"] = $context->get_title(); + if (!empty($contexts)) { + foreach ($contexts as $id => $context) { + if ($keyword = $context->get_keyword()) { + $keywords["%$keyword"] = $context->get_title(); + } } } return $keywords; @@ -1222,9 +1224,11 @@ function panels_context_match_required_contexts($required, $contexts) { * Return the first context with a form id from a list of contexts. */ function panels_context_get_form($contexts) { - foreach ($contexts as $context) { - if (!empty($context->form_id)) { - return $context; + if (!empty($contexts)) { + foreach ($contexts as $context) { + if (!empty($context->form_id)) { + return $context; + } } } }