[gnumeric] ODF: check for NULL and don't assert but do some reasonable



commit b032289da39e331862f0331d7f838540d5fd11a2
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Sep 13 08:03:29 2010 -0600

    ODF: check for NULL and don't assert but do some reasonable
    
    2010-09-13  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (od_style_prop_chart): check for NULL
    	* openoffice-write.c (odf_write_line): an unknown
    	  anchor->base.direction should behave like GOD_ANCHOR_DIR_UNKNOWN

 plugins/openoffice/ChangeLog          |    6 ++++++
 plugins/openoffice/openoffice-read.c  |    3 +++
 plugins/openoffice/openoffice-write.c |    5 +----
 3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index c87e3db..8369d60 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,4 +1,10 @@
 2010-09-13  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* openoffice-read.c (od_style_prop_chart): check for NULL
+	* openoffice-write.c (odf_write_line): an unknown 
+	  anchor->base.direction should behave like GOD_ANCHOR_DIR_UNKNOWN
+	
+2010-09-13  Andreas J. Guelzow <aguelzow pyrshep ca>
 	
 	* openoffice-read.c (oo_marker_free): new
 	(odf_get_arrow_marker): use the imported markers
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 73c825e..a88b4e1 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -4089,6 +4089,9 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 	gboolean draw_stroke_set = FALSE;
 	gboolean draw_stroke;
 
+	g_return_if_fail (style != NULL || 
+			  state->default_style.cells != NULL);
+
 	if (style == NULL && state->default_style.cells != NULL) {
 		style = g_new (OOChartStyle, 1);
 	}
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 06086ac..8e0d156 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -2685,6 +2685,7 @@ odf_write_line (GnmOOExport *state, SheetObject *so)
 	sheet_object_anchor_to_pts (anchor, state->sheet, res_pts);
 
 	switch (anchor->base.direction) {
+	default:
 	case GOD_ANCHOR_DIR_UNKNOWN:
 	case GOD_ANCHOR_DIR_UP_RIGHT:
 		x1 = res_pts[0];
@@ -2710,10 +2711,6 @@ odf_write_line (GnmOOExport *state, SheetObject *so)
 		y1 = res_pts[1];
 		y2 = res_pts[3];
 		break;
-	default:
-		/* This really shouldn't happen */
-		g_error ("How can we get here?");
-		g_assert(0);
 	}
 
 	odf_add_pt (state->xml, SVG "x1", x1);



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