[gnumeric] xlsx: fix crash with we are missing a plot.



commit e5787f3ae700c53a3335d82762845e6da6f0abd4
Author: Morten Welinder <terra gnome org>
Date:   Tue Jan 27 15:26:02 2015 -0500

    xlsx: fix crash with we are missing a plot.
    
    We're only missing a plot because we cannot handle charts-tests yet.

 plugins/excel/xlsx-read-drawing.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index a873df8..b43e5a4 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -683,14 +683,19 @@ xlsx_chart_logbase (GsfXMLIn *xin, xmlChar const **attrs)
 static void
 xlsx_create_axis_object (XLSXReadState *state)
 {
-       GogPlot *plot = state->axis.info->plots->data; /* just use the first */
-       char const *type = G_OBJECT_TYPE_NAME (plot);
+       GogPlot *plot;
+       char const *type;
        char const *role = NULL;
        gboolean inverted = FALSE;
        gboolean cat_or_date = (state->axis.type == XLSX_AXIS_CAT ||
                                state->axis.type == XLSX_AXIS_DATE);
        GogObject *axis;
 
+       plot = state->axis.info && state->axis.info->plots
+               ? state->axis.info->plots->data /* just use the first */
+               : NULL;
+       type = plot ? G_OBJECT_TYPE_NAME (plot) : "GogLinePlot";
+
        switch (xlsx_plottype_from_type_name (type)) {
        case XLSX_PT_GOGRADARPLOT:
        case XLSX_PT_GOGRADARAREAPLOT:


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