[gnumeric] fix border crash in ODF export [#703951]



commit 29da18deb28593869688af265692b45870e66dd2
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Jul 10 08:25:56 2013 -0600

    fix border crash in ODF export [#703951]
    
    2013-07-10  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-write.c (BORDERSTYLE): check for NULL border

 plugins/openoffice/ChangeLog          |    4 ++++
 plugins/openoffice/openoffice-write.c |   14 ++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 2032c61..51ef684 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-10  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-write.c (BORDERSTYLE): check for NULL border
+
 2013-07-02  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-write.c (odf_write_gog_position_pts): only write
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 1ced148..64e1a92 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -1140,16 +1140,18 @@ odf_get_gnm_border_format (GnmBorder   *border)
 
 
 #define BORDERSTYLE(msbw, msbwstr, msbwstr_wth, msbwstr_gnm) if (gnm_style_is_element_set (style, msbw)) { \
-                       GnmBorder *border = gnm_style_get_border (style, msbw); \
+               GnmBorder *border = gnm_style_get_border (style, msbw); \
+               if (border != NULL) {                                   \
                        char *border_style = odf_get_border_format (border); \
                        char const *gnm_border_style = odf_get_gnm_border_format (border); \
                        gsf_xml_out_add_cstr_unchecked (state->xml, msbwstr, border_style); \
-                       g_free (border_style); \
-                        if (gnm_border_style != NULL && state->with_extension) \
+                       g_free (border_style);                          \
+                       if (gnm_border_style != NULL && state->with_extension) \
                                gsf_xml_out_add_cstr_unchecked (state->xml, msbwstr_gnm, gnm_border_style); \
-                        if (border->line_type == GNM_STYLE_BORDER_DOUBLE) \
-                               gsf_xml_out_add_cstr_unchecked (state->xml, msbwstr_wth, "0.03cm 0.03cm 
0.03cm "); \
-               }
+                       if (border->line_type == GNM_STYLE_BORDER_DOUBLE) \
+                               gsf_xml_out_add_cstr_unchecked (state->xml, msbwstr_wth, "0.03cm 0.03cm 
0.03cm "); \
+               }                                                       \
+       }
 
 #define UNDERLINESPECS(type, style, width) gsf_xml_out_add_cstr (state->xml, \
                                                      STYLE "text-underline-type", type); \


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