diff --git a/includes/common.inc b/includes/common.inc
index cbfdabb..992601b 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -6140,9 +6140,14 @@ function element_children(&$elements, $sort = FALSE) {
   $sortable = FALSE;
   foreach ($elements as $key => $value) {
     if ($key === '' || $key[0] !== '#') {
-      $children[$key] = $value;
-      if (is_array($value) && isset($value['#weight'])) {
-        $sortable = TRUE;
+      if (is_array($value)) {
+        $children[$key] = $value;
+        if (isset($value['#weight'])) {
+          $sortable = TRUE;
+        }
+      }
+      else {
+        drupal_set_message(t('@key is an invalid render array key.', array('@key' => $key)));
       }
     }
   }
