[gnumeric] ods: avoid criticals when resizing.



commit 16425e7d540e60d35eb8678257a8092e9c04e15b
Author: Morten Welinder <terra gnome org>
Date:   Sun Aug 2 11:02:12 2020 -0400

    ods: avoid criticals when resizing.
    
    1. Don't go below our minimums; 2. The undo object can be NULL.

 plugins/openoffice/openoffice-read.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index fc80d8257b..7668d7fc89 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -13921,8 +13921,8 @@ openoffice_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_cont
        int i;
        gboolean         content_malformed = FALSE;
        GSList          *l;
-       int              max_rows = 0;
-       int              max_cols = 0;
+       int              max_rows = GNM_MIN_ROWS;
+       int              max_cols = GNM_MIN_COLS;
 
        zip = gsf_infile_zip_new (input, &err);
        if (zip == NULL) {
@@ -14133,9 +14133,11 @@ openoffice_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_cont
                sheet_order_t *sot;
                gboolean perr = FALSE;
                sot = (sheet_order_t *)(l->data);
-               if ((sot->cols < max_cols) || (sot->rows < max_rows))
-                       g_object_unref (gnm_sheet_resize (sot->sheet, max_cols, max_rows,
-                                                         NULL, &perr));
+               if ((sot->cols < max_cols) || (sot->rows < max_rows)) {
+                       GOUndo *undo = gnm_sheet_resize (sot->sheet, max_cols, max_rows,
+                                                         NULL, &perr);
+                       if (undo) g_object_unref (undo);
+               }
                l = l->next;
        }
 


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