diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 2b64ca65af1ed3947d4162ce008503dc5e06f323..92a8984ad2afe58fa3d0c5fc02ff234a8690698a 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -2161,7 +2161,14 @@ function comment_submit($comment) {
     // 1) Filter it into HTML
     // 2) Strip out all HTML tags
     // 3) Convert entities back to plain-text.
-    $comment->subject = truncate_utf8(trim(decode_entities(strip_tags(check_markup($comment->comment_body[LANGUAGE_NONE][0]['value'], $comment->comment_body[LANGUAGE_NONE][0]['format'])))), 29, TRUE);
+    $comment_body = $comment->comment_body[LANGUAGE_NONE][0];
+    if (isset($comment_body['format'])) {
+      $comment_text = check_markup($comment_body['value'], $comment_body['format']);
+    }
+    else {
+      $comment_text = check_plain($comment_body['value']);
+    }
+    $comment->subject = truncate_utf8(trim(decode_entities(strip_tags($comment_text))), 29, TRUE);
     // Edge cases where the comment body is populated only by HTML tags will
     // require a default subject.
     if ($comment->subject == '') {
diff --git a/modules/comment/comment.test b/modules/comment/comment.test
index 770e01d4a5fe49f1ab92f7e62f246ea3a3bf855b..82c6008939f4bb674719ad17ddf032289e31213c 100644
--- a/modules/comment/comment.test
+++ b/modules/comment/comment.test
@@ -1912,4 +1912,19 @@ class CommentFieldsTest extends CommentHelperCase {
     $this->postComment($book_node, $this->randomName(), $this->randomName());
     $this->postComment($poll_node, $this->randomName(), $this->randomName());
   }
+
+  /**
+   * Test that comment module works correctly with plain text format.
+   */
+  function testCommentFormat() {
+    // Disable text processing for comments.
+    $this->drupalLogin($this->admin_user);
+    $edit = array('instance[settings][text_processing]' => 0);
+    $this->drupalPost('admin/structure/types/manage/article/comment/fields/comment_body', $edit, t('Save settings'));
+
+    // Post a comment without an explicit subject.
+    $this->drupalLogin($this->web_user);
+    $edit = array('comment_body[und][0][value]' => $this->randomName(8));
+    $this->drupalPost('node/' . $this->node->nid, $edit, t('Save'));
+  }
 }