diff --git a/includes/ajax.inc b/includes/ajax.inc
index 50e8e28..c1ce212 100644
--- a/includes/ajax.inc
+++ b/includes/ajax.inc
@@ -577,7 +577,10 @@ function ajax_prepare_response($page_callback_result) {
     $commands[] = ajax_command_insert(NULL, $html);
     // Add the status messages inside the new content's wrapper element, so that
     // on subsequent Ajax requests, it is treated as old content.
-    $commands[] = ajax_command_prepend(NULL, theme('status_messages'));
+    $status_messages = theme('status_messages');
+    if ($status_messages != '') {
+      $commands[] = ajax_command_prepend(NULL, $status_messages);
+    }
   }
 
   return $commands;
