Index: plugins.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/panels/includes/plugins.inc,v
retrieving revision 1.12
diff -u -r1.12 plugins.inc
--- plugins.inc	3 Sep 2008 02:13:19 -0000	1.12
+++ plugins.inc	3 Sep 2008 18:55:19 -0000
@@ -1120,9 +1120,11 @@
  */
 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 @@
  * 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;
+      }
     }
   }
 }
