[gnumeric] Fix crash on resaving LibreOffice created xlsx files with unauthored comments. [#642850]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix crash on resaving LibreOffice created xlsx files with unauthored comments. [#642850]
- Date: Tue, 22 Feb 2011 05:20:46 +0000 (UTC)
commit 91f8a58d3d93532248f67c0a9006f0b4975a1928
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Mon Feb 21 22:25:36 2011 -0700
Fix crash on resaving LibreOffice created xlsx files with unauthored comments. [#642850]
2011-02-21 Andreas J. Guelzow <aguelzow pyrshep ca>
* xlsx-write.c (xlsx_write_comments): skip NULL author
(see glib bug #642944)
NEWS | 2 ++
plugins/excel/ChangeLog | 5 +++++
plugins/excel/xlsx-write.c | 7 +++++--
3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 0530eb7..661d5b9 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ Andreas:
* Minor histogram improvements.
* Fix import of LibreOffice created xlsx files using shared formulas.
[#642850]
+ * Fix crash on resaving LibreOffice created xlsx files with unauthored
+ comments. [#642850]
Jean:
* Fix cursor position inside a cell edited in a zoomed sheet. [#641709]
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index cc77e7c..411ce3c 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,10 @@
2011-02-21 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * xlsx-write.c (xlsx_write_comments): skip NULL author
+ (see glib bug #642944)
+
+2011-02-21 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* xlsx-read.c (xlsx_chart_dtd): add c:crossesAt
(xlsx_cell_expr_begin): don't ignore shared expressions with
duplicate id
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index c589a72..129853e 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -1352,7 +1352,7 @@ xlsx_write_comments (XLSXWriteState *state, GsfOutput *sheet_part, GSList *objec
authors = g_hash_table_new (g_str_hash, g_str_equal);
for (ptr = objects; ptr; ptr = ptr->next) {
authorname = cell_comment_author_get (CELL_COMMENT (ptr->data));
- if (!g_hash_table_lookup_extended (authors, authorname, NULL, NULL))
+ if (authorname != NULL && !g_hash_table_lookup_extended (authors, authorname, NULL, NULL))
g_hash_table_insert (authors, (gpointer) authorname, GUINT_TO_POINTER (author++));
}
/* save authors */
@@ -1365,7 +1365,10 @@ xlsx_write_comments (XLSXWriteState *state, GsfOutput *sheet_part, GSList *objec
gsf_xml_out_start_element (xml, "comment");
anchor = sheet_object_get_anchor (ptr->data);
gsf_xml_out_add_cstr_unchecked (xml, "ref", range_as_string (&anchor->cell_bound));
- gsf_xml_out_add_uint (xml, "authorId", GPOINTER_TO_UINT (g_hash_table_lookup (authors, cell_comment_author_get (CELL_COMMENT (ptr->data)))));
+ authorname = cell_comment_author_get (CELL_COMMENT (ptr->data));
+ if (authorname != NULL)
+ gsf_xml_out_add_uint (xml, "authorId",
+ GPOINTER_TO_UINT (g_hash_table_lookup (authors, authorname)));
gsf_xml_out_start_element (xml, "text");
/* Save text as rich text */
g_object_get (ptr->data, "text", &name, "markup", &attrs, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]