[gnumeric] xml: fix loading of empty strings.



commit fd46865316d7591cff3a210265a2c34b3002e801
Author: Morten Welinder <terra gnome org>
Date:   Wed Apr 21 12:02:39 2010 -0400

    xml: fix loading of empty strings.

 ChangeLog          |    3 +++
 NEWS               |    1 +
 src/value.c        |    1 +
 src/xml-sax-read.c |    7 +++++--
 4 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2232509..2d64fd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-04-21  Morten Welinder  <terra gnome org>
 
+	* src/xml-sax-read.c (xml_sax_cell_content): Handle empty strings.
+	Fixes #616139.
+
 	* src/cell.c (gnm_cell_get_entered_text): Make sure the empty
 	string gets quoted.  Fixes part of #616139.
 
diff --git a/NEWS b/NEWS
index 0536ddf..1218ad6 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Jean
 
 Morten:
 	* Make sure an empty string is shown with a quote.
+	* Fix problem loading cells with empty strings.  [#616139]
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.2
diff --git a/src/value.c b/src/value.c
index 001eaa8..56dbc59 100644
--- a/src/value.c
+++ b/src/value.c
@@ -473,6 +473,7 @@ value_new_from_string (GnmValueType t, char const *str, GOFormat *sf,
 		       gboolean translated)
 {
 	GnmValue *res = NULL;
+
 	switch (t) {
 	case VALUE_EMPTY:
 		res = value_new_empty ();
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index 5477238..8116253 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -2008,13 +2008,16 @@ xml_sax_cell_content (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 			cc->texpr = texpr;
 			gnm_expr_top_ref (texpr);
 		}
-	} else if (is_new_cell)
+	} else if (is_new_cell) {
 		/*
 		 * Only set to empty if this is a new cell.
 		 * If it was created by a previous array
 		 * we do not want to erase it.
 		 */
-		gnm_cell_set_value (cell, value_new_empty ());
+		gnm_cell_set_value (cell,
+				    value_new_from_string (value_type, "",
+							   NULL, FALSE));
+	}
 
 	go_format_unref (value_fmt);
 }



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