[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kmail
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2009-07-31 14:48:01
Message-ID: 1249051681.782452.10144.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1005208 by tmcguire:

Catch DOM exceptions.
This should at fix Dmitry's crash, although I couldn't reproduce it.

CCMAIL: dpimka@dpimka.org


 M  +17 -9     htmlquotecolorer.cpp  


--- trunk/KDE/kdepim/kmail/htmlquotecolorer.cpp #1005207:1005208
@@ -22,6 +22,7 @@
 
 #include <dom/html_document.h>
 #include <dom/dom_element.h>
+#include <dom/dom_exception.h>
 
 namespace KMail {
 
@@ -32,16 +33,23 @@
 
 QString HTMLQuoteColorer::process( const QString &htmlSource )
 {
-  // Create a DOM Document from the HTML source
-  DOM::HTMLDocument doc;
-  doc.open();
-  doc.write( htmlSource );
-  doc.close();
+  try {
+    // Create a DOM Document from the HTML source
+    DOM::HTMLDocument doc;
+    doc.open();
+    doc.write( htmlSource );
+    doc.close();
 
-  mIsQuotedLine = false;
-  mIsFirstTextNodeInLine = true;
-  processNode( doc.documentElement() );
-  return doc.toString().string();
+    mIsQuotedLine = false;
+    mIsFirstTextNodeInLine = true;
+    processNode( doc.documentElement() );
+    return doc.toString().string();
+  }
+  catch( const DOM::DOMException &exception ) {
+    kWarning() << "Got a DOM exception with code" << exception.code;
+    kWarning() << "No quote coloring for you, then.";
+    return htmlSource;
+  }
 }
 
 DOM::Node HTMLQuoteColorer::processNode( DOM::Node node )
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic