Bug 857678 - crash in nsMsgDatabase::RowCellColumnToCollationKey. r=jcranmer, a=jcranmer
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Thu, 22 Aug 2013 22:06:47 +0300
changeset 16424 339bc9eac2fce242fcb4354fd1505e94a3fe8edf
parent 16423 8e9531bfd45a2f6aed1cb855305b0b8ed37445ee
child 16425 dd169329db9d67f0b73d61d1b4912baf5e19cc6f
push id1019
push userbugzilla@standard8.plus.com
push dateMon, 28 Oct 2013 22:08:40 +0000
treeherdercomm-beta@c81d5f517a5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcranmer, jcranmer
bugs857678
Bug 857678 - crash in nsMsgDatabase::RowCellColumnToCollationKey. r=jcranmer, a=jcranmer CLOSED TREE
mailnews/db/msgdb/src/nsMsgDatabase.cpp
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -3599,42 +3599,36 @@ NS_IMETHODIMP nsMsgDatabase::CopyHdrFrom
         *newHdr = destMsgHdr;
     }
   }
   return err;
 }
 
 nsresult nsMsgDatabase::RowCellColumnTonsString(nsIMdbRow *hdrRow, mdb_token columnToken, nsAString &resultStr)
 {
-  nsresult  err = NS_OK;
-
-  if (hdrRow)  // ### probably should be an error if hdrRow is NULL...
-  {
-    struct mdbYarn yarn;
-    err = hdrRow->AliasCellYarn(GetEnv(), columnToken, &yarn);
-    if (NS_SUCCEEDED(err))
-      YarnTonsString(&yarn, resultStr);
-  }
-  return err;
+  NS_ENSURE_ARG_POINTER(hdrRow);
+
+  struct mdbYarn yarn;
+  nsresult rv = hdrRow->AliasCellYarn(GetEnv(), columnToken, &yarn);
+  NS_ENSURE_SUCCESS(rv, rv);
+  YarnTonsString(&yarn, resultStr);
+  return NS_OK;
 }
 
 // as long as the row still exists, and isn't changed, the returned const char ** will be valid.
 // But be very careful using this data - the caller should never return it in turn to another caller.
 nsresult nsMsgDatabase::RowCellColumnToConstCharPtr(nsIMdbRow *hdrRow, mdb_token columnToken, const char **ptr)
 {
-  nsresult  err = NS_OK;
-
-  if (hdrRow)  // ### probably should be an error if hdrRow is NULL...
-  {
-    struct mdbYarn yarn;
-    err = hdrRow->AliasCellYarn(GetEnv(), columnToken, &yarn);
-    if (NS_SUCCEEDED(err))
-      *ptr = (const char*)yarn.mYarn_Buf;
-  }
-  return err;
+  NS_ENSURE_ARG_POINTER(hdrRow);
+
+  struct mdbYarn yarn;
+  nsresult rv = hdrRow->AliasCellYarn(GetEnv(), columnToken, &yarn);
+  NS_ENSURE_SUCCESS(rv, rv);
+  *ptr = (const char*)yarn.mYarn_Buf;
+  return NS_OK;
 }
 
 nsIMimeConverter *nsMsgDatabase::GetMimeConverter()
 {
   if (!m_mimeConverter)
   {
     // apply mime decode
     m_mimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID);