r14015 by jghali - #8433: ODG import crashes Scribus

scribus-commit scribus-commit at lists.scribus.net
Mon Sep 21 21:05:18 CEST 2009


Revision: 14015
Author: jghali
Date: 2009-09-21T19:03:30.972195Z
Commit message: #8433: ODG import crashes Scribus 

Changeset: 
M  /branches/Version133x/Scribus/scribus/plugins/fileloader/oodraw/oodrawimp.cpp

Diffs:
Index: scribus/plugins/fileloader/oodraw/oodrawimp.cpp
===================================================================
--- scribus/plugins/fileloader/oodraw/oodrawimp.cpp	(revision 14014)
+++ scribus/plugins/fileloader/oodraw/oodrawimp.cpp	(revision 14015)
@@ -292,14 +292,20 @@
 	if (isOODraw2)
 	{
 		style = m_styles[master->attribute( "style:page-layout-name" )];
-		properties = style->namedItem( "style:page-layout-properties" ).toElement();
+		if (style)
+		{
+			properties = style->namedItem( "style:page-layout-properties" ).toElement();
+		}
 	}
 	else
 	{
 		style = m_styles[master->attribute( "style:page-master-name" )];
-		properties = style->namedItem( "style:properties" ).toElement();
+		if (style)
+		{
+			properties = style->namedItem( "style:properties" ).toElement();
+		}
 	}
-	double width = !properties.attribute( "fo:page-width" ).isEmpty() ? parseUnit(properties.attribute( "fo:page-width" ) ) : 550.0;
+	double width  = !properties.attribute( "fo:page-width" ).isEmpty()  ? parseUnit(properties.attribute( "fo:page-width" ) ) : 550.0;
 	double height = !properties.attribute( "fo:page-height" ).isEmpty() ? parseUnit(properties.attribute( "fo:page-height" ) ) : 841.0;
 	if (!interactive || (flags & LoadSavePlugin::lfInsertPage))
 		ScMW->doc->setPage(width, height, 0, 0, 0, 0, 0, 0, false, false);
@@ -926,9 +932,15 @@
 
 void OODPlug::addStyles( const QDomElement* style )
 {
-	if( style->hasAttribute( "style:parent-style-name" ) )
-		addStyles( m_styles[style->attribute( "style:parent-style-name" )] );
-	m_styleStack.push( *style );
+	if (style)
+	{
+		if( style->hasAttribute( "style:parent-style-name" ) )
+		{
+			QDomElement* elem = m_styles[style->attribute( "style:parent-style-name" )];
+			addStyles( m_styles[style->attribute( "style:parent-style-name" )] );
+		}
+		m_styleStack.push( *style );
+	}
 }
 
 void OODPlug::storeObjectStyles( const QDomElement& object )
@@ -1614,3 +1626,4 @@
 OODPlug::~OODPlug()
 {}
 
+




More information about the scribus-commit mailing list