diff --git includes/theme.inc includes/theme.inc
index 3f5a0e9..cd2b5a3 100644
--- includes/theme.inc
+++ includes/theme.inc
@@ -1738,6 +1738,11 @@ function theme_table($variables) {
     }
   }
 
+  // Add the 'empty' row message if available.
+  if (!count($rows) && $empty) {
+    $rows[] = array(array('data' => $empty, 'colspan' => count($header), 'class' => array('empty', 'message')));
+  }
+
   // Format the table header:
   if (count($header)) {
     $ts = tablesort_init($header);
@@ -1755,11 +1760,6 @@ function theme_table($variables) {
     $ts = array();
   }
 
-  // Add the 'empty' row message if available.
-  if (!count($rows) && $empty) {
-    $rows[] = array(array('data' => $empty, 'colspan' => count($header), 'class' => array('empty', 'message')));
-  }
-
   // Format the table rows:
   if (count($rows)) {
     $output .= "<tbody>\n";
