[geary] Guard against length-0 blockquotes in html_to_flowed_text



commit b0de5365a1e22fee14559b0ba0ccdf2ace2db74b
Author: Robert Schroll <rschroll gmail com>
Date:   Wed Jan 14 13:16:39 2015 -0800

    Guard against length-0 blockquotes in html_to_flowed_text
    
    We can end up with these from odd user selections.

 src/client/util/util-webkit.vala |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/client/util/util-webkit.vala b/src/client/util/util-webkit.vala
index a5d347e..d870388 100644
--- a/src/client/util/util-webkit.vala
+++ b/src/client/util/util-webkit.vala
@@ -326,7 +326,7 @@ public string html_to_flowed_text(WebKit.DOM.HTMLElement el) {
     for (int i = nbq - 1; i >= 0; i--) {
         WebKit.DOM.HTMLElement bq = (WebKit.DOM.HTMLElement) blockquotes.item(i);
         bqtexts[i] = bq.get_inner_text();
-        if (bqtexts[i].substring(-1, 1) == "\n")
+        if (bqtexts[i].length > 0 && bqtexts[i].substring(-1, 1) == "\n")
             bqtexts[i] = bqtexts[i].slice(0, -1);
         else
             debug("Did not find expected newline at end of quote.");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]