[gnumeric] Fix xls import of sheet labels [#586066]



commit e7816d2e9049370b895c4ee2d20646dc8efff1d0
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Tue Jun 16 19:11:03 2009 -0600

    Fix xls import of sheet labels [#586066]
    
    2009-06-16  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/gnm-so-filled.c (gnm_so_filled_write_xml_sax): be rather safe
    	  than sorry and check whether sof->text is NULL
    	(gnm_so_filled_set_property): make sure sof->text does not become
    	  NULL. (If it is NULL the foocanvas items don't notice it changing.)

 ChangeLog           |    7 +++++++
 NEWS                |    1 +
 src/gnm-so-filled.c |    6 ++++--
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f6967b9..b4477d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-06-16  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/gnm-so-filled.c (gnm_so_filled_write_xml_sax): be rather safe
+	  than sorry and check whether sof->text is NULL
+	(gnm_so_filled_set_property): make sure sof->text does not become
+	  NULL. (If it is NULL the foocanvas items don't notice it changing.)
+	
 2009-06-16  Morten Welinder  <terra gnome org>
 
 	* src/func.c (dump_externals): New function for creating what will
diff --git a/NEWS b/NEWS
index 0b0c415..abbfcae 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ Andreas:
 	* Improve print area handling and export to ODF
 	* Some minor menu rearrangement
 	* Let the sort dialog guess whether there is a header
+	* Fix xls import of sheet labels [#586066]
 
 Jody:
 	* GOString start of richtext and phonetic support.
diff --git a/src/gnm-so-filled.c b/src/gnm-so-filled.c
index a5a995c..9fbd421 100644
--- a/src/gnm-so-filled.c
+++ b/src/gnm-so-filled.c
@@ -338,7 +338,7 @@ gnm_so_filled_write_xml_sax (SheetObject const *so, GsfXMLOut *output,
 	gsf_xml_out_add_float   (output, "Width", sof->style->outline.width, 2);
 	gnm_xml_out_add_gocolor (output, "OutlineColor", sof->style->outline.color);
 	gnm_xml_out_add_gocolor (output, "FillColor",	 sof->style->fill.pattern.back);
-	if (*(sof->text) != '\0') {
+	if (sof->text != NULL && *(sof->text) != '\0') {
 		gsf_xml_out_add_cstr (output, "Label", sof->text);
 		if (sof->markup != NULL) {
 			GOFormat *fmt = go_format_new_markup	(sof->markup, TRUE);
@@ -424,6 +424,7 @@ gnm_so_filled_set_property (GObject *obj, guint param_id,
 {
 	GnmSOFilled *sof = GNM_SO_FILLED (obj);
 	GOStyle *style;
+	char const * str;
 
 	switch (param_id) {
 	case SOF_PROP_STYLE:
@@ -437,7 +438,8 @@ gnm_so_filled_set_property (GObject *obj, guint param_id,
 		break;
 	case SOF_PROP_TEXT:
 		g_free (sof->text);
-		sof->text = g_strdup (g_value_get_string (value));
+		str = g_value_get_string (value);
+		sof->text = g_strdup (str == NULL ? "" : str);
 		break;
 	case SOF_PROP_MARKUP:
 		if (sof->markup != NULL)



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