r14564 by fschmid - DRW Importer: fixed crash caused by degenerated paths.

scribus-commit scribus-commit at lists.scribus.net
Fri Jan 22 20:25:21 CET 2010


Revision: 14564
Author: fschmid
Date: 2010-01-22T19:21:12.542507Z
Commit message: DRW Importer: fixed crash caused by degenerated paths.

Changeset: 
M  /trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp

Diffs:
Index: scribus/plugins/import/drw/importdrw.cpp
===================================================================
--- scribus/plugins/import/drw/importdrw.cpp	(revision 14563)
+++ scribus/plugins/import/drw/importdrw.cpp	(revision 14564)
@@ -786,18 +786,21 @@
 								pa = item->PoLine.toQPainterPath(false);
 							else
 								pa = item->PoLine.toQPainterPath(true);
-							const QPainterPath::Element &elm = pa.elementAt(0);
-							QPointF lastP = gesPa.currentPosition();
-							bool conn = false;
-							if ((fabs(lastP.x() - elm.x) > 3) || (fabs(lastP.y() - elm.y) > 3))
-								conn = true;
-							if ((firstP) || (conn))
+							if (!pa.isEmpty())
 							{
-								gesPa.addPath(pa);
-								firstP = false;
+								const QPainterPath::Element &elm = pa.elementAt(0);
+								QPointF lastP = gesPa.currentPosition();
+								bool conn = false;
+								if ((fabs(lastP.x() - elm.x) > 3) || (fabs(lastP.y() - elm.y) > 3))
+									conn = true;
+								if ((firstP) || (conn))
+								{
+									gesPa.addPath(pa);
+									firstP = false;
+								}
+								else
+									gesPa.connectPath(pa);
 							}
-							else
-								gesPa.connectPath(pa);
 						}
 						FPointArray res;
 						res.fromQPainterPath(gesPa);




More information about the scribus-commit mailing list