[gnumeric] avoid null pointer on incomplete ODF file
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] avoid null pointer on incomplete ODF file
- Date: Sat, 18 Sep 2010 16:09:46 +0000 (UTC)
commit c65d21af39684bfdafbedf3a8828ca1c2ddfac1a
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Sat Sep 18 10:08:13 2010 -0600
avoid null pointer on incomplete ODF file
2010-09-18 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (odf_created_by_gnumeric): avoid null pointer
on incomplete ODF file.
plugins/openoffice/ChangeLog | 5 +++++
plugins/openoffice/openoffice-read.c | 9 ++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 91be555..7108e5a 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
2010-09-18 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-read.c (odf_created_by_gnumeric): avoid null pointer
+ on incomplete ODF file.
+
+2010-09-18 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (odf_created_by_gnumeric): new
(openoffice_file_open): set saveinfo
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 1f1e30a..5e44a95 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -6868,9 +6868,12 @@ odf_created_by_gnumeric (OOParseState *state)
GsfDocMetaData *meta_data = go_doc_get_meta_data (GO_DOC (state->pos.wb));
GsfDocProp *prop = gsf_doc_meta_data_lookup (meta_data,
"meta:generator");
- char const *str = g_value_get_string (gsf_doc_prop_get_val (prop));
- gboolean res = g_str_has_prefix (str, "gnumeric");
- return res;
+ char const *str;
+
+ return (prop != NULL &&
+ (NULL != (str = g_value_get_string
+ (gsf_doc_prop_get_val (prop)))) &&
+ g_str_has_prefix (str, "gnumeric"));
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]