bug 827061 - don't attempt to find potential line-breaks within an empty string. r=standard8
authorJonathan Kew <jkew@mozilla.com>
Thu, 07 Feb 2013 14:38:56 +0000
changeset 14819 e63ea30fd18be2d0ffb977475ca4b4a12b0f040d
parent 14818 64469a1a2402e7c02ce7f916d92adb11096417e8
child 14820 1a75aaebea69eaad9cc210113448d1c92f920641
push id867
push userbugzilla@standard8.plus.com
push dateMon, 01 Apr 2013 20:44:27 +0000
treeherdercomm-beta@797726b8d244 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs827061
bug 827061 - don't attempt to find potential line-breaks within an empty string. r=standard8
mailnews/compose/src/nsMsgComposeService.cpp
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -440,16 +440,19 @@ nsMsgComposeService::GetOrigWindowSelect
     nsAutoString selPlain;
     rv = sel->ToString(selPlain);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // If "mailnews.reply_quoting_selection.multi_word" is on, then there must be at least
     // two words selected in order to quote just the selected text
     if (requireMultipleWords)
     {
+      if (selPlain.IsEmpty())
+        return NS_ERROR_ABORT;
+
       nsCOMPtr<nsILineBreaker> lineBreaker = do_GetService(NS_LBRK_CONTRACTID, &rv);
 
       if (NS_SUCCEEDED(rv))
       {
         const uint32_t length = selPlain.Length();
         const PRUnichar* unicodeStr = selPlain.get();
         int32_t endWordPos = lineBreaker->Next(unicodeStr, length, 0);