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

List:       kde-commits
Subject:    koffice/filters/kword/rtf/import
From:       Thomas Zander <zander () kde ! org>
Date:       2009-09-18 10:48:35
Message-ID: 1253270915.996782.21525.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1025308 by zander:

Stop crashing when opening certain rtf files.

 M  +4 -4      rtfimport.cpp  


--- trunk/koffice/filters/kword/rtf/import/rtfimport.cpp #1025307:1025308
@@ -2093,8 +2093,9 @@
         if (!baseFormat || format.fmt.color != baseFormat->color)
         {
             node.addNode( "COLOR" );
-            node.addColor( (format.fmt.color >= colorTable.count())
-                           ? QColor(Qt::black) : colorTable[format.fmt.color] );
+            node.addColor((format.fmt.color < colorTable.count() && format.fmt.color >= 0)
+                           ? colorTable.value(format.fmt.color) : QColor(Qt::black));
+
             node.closeNode( "COLOR" );
         }
         if (format.fmt.bgcolor < colorTable.count() &&
@@ -2585,8 +2586,7 @@
             }
 
             // Frame background color
-            if (row.cells[k].bgcolor < colorTable.count())
-            {
+            if (row.cells[k].bgcolor < colorTable.count() && row.cells[k].bgcolor >= 0) {
                 QColor &color = colorTable[row.cells[k].bgcolor];
                 frameSets.setAttribute( "bkRed", color.red() );
                 frameSets.setAttribute( "bkGreen", color.green() );
[prev in list] [next in list] [prev in thread] [next in thread] 

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