[gnumeric] ssconvert: avoid critial.



commit 070347ebfd200a9d78d3bd491cb9107c51f2fc76
Author: Morten Welinder <terra gnome org>
Date:   Sun Apr 12 15:57:18 2020 -0400

    ssconvert: avoid critial.

 ChangeLog       | 3 +++
 src/ssconvert.c | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f4f4680a8..f0f71e5d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2020-04-12  Morten Welinder  <terra gnome org>
 
+       * src/ssconvert.c (clipboard_export): Avoid critical.
+       (convert): Avoid critical.
+
        * src/workbook-view.c (workbook_view_new_from_input): Spell out
        which file we complain over.  See #472.
 
diff --git a/src/ssconvert.c b/src/ssconvert.c
index 089b2ccb5..a01509294 100644
--- a/src/ssconvert.c
+++ b/src/ssconvert.c
@@ -895,13 +895,14 @@ do_split_save (GOFileSaver *fs, WorkbookView *wbv,
 static int
 apply_updates (WorkbookView *wbv)
 {
-       Workbook *wb = wb_view_get_workbook (wbv);
+       Workbook *wb;
        unsigned ui;
        GnmParsePos pp;
 
        if (!ssconvert_set_cells)
                return 0;
 
+       wb = wb_view_get_workbook (wbv);
        pp.wb = wb;
        pp.sheet = workbook_sheet_by_index (wb, 0);
        pp.eval.col = 0;
@@ -1024,7 +1025,7 @@ convert (char const *inarg, char const *outarg, char const *mergeargs[],
                wbv = workbook_view_new_from_uri (infile, fo,
                                                  io_context,
                                                  ssconvert_import_encoding);
-               if (apply_updates (wbv)) {
+               if (wbv && apply_updates (wbv)) {
                        res = 1;
                        goto out;
                }
@@ -1178,7 +1179,7 @@ clipboard_export (const char *inarg, char const *outarg, GOCmdContext *cc)
        wbv = workbook_view_new_from_uri (infile, fo,
                                          io_context,
                                          ssconvert_import_encoding);
-       if (apply_updates (wbv)) {
+       if (wbv && apply_updates (wbv)) {
                res = 1;
                goto out;
        }


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