[evolution] gal-view-instance: Do not crash on broken setup



commit 6c5ea130ae3cfe40bd6ef79e680db9d94c57543f
Author: Milan Crha <mcrha redhat com>
Date:   Fri Mar 25 07:49:58 2022 +0100

    gal-view-instance: Do not crash on broken setup
    
    When there's saved an unknown view, which cannot be loaded, the code
    could crash. This change makes sure the first view in the collection
    will be loaded, instead of crashing the application.

 src/e-util/gal-view-instance.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/e-util/gal-view-instance.c b/src/e-util/gal-view-instance.c
index bf0469a95d..b0ee38e9e4 100644
--- a/src/e-util/gal-view-instance.c
+++ b/src/e-util/gal-view-instance.c
@@ -315,6 +315,12 @@ load_current_view (GalViewInstance *instance)
                g_free (type);
        }
 
+       if (view == NULL) {
+               /* If everything fails, maybe due to broken setup, default to the first view in the 
collection. */
+               view = gal_view_collection_get_view (instance->collection, 0);
+               view = gal_view_clone (view);
+       }
+
        connect_view (instance, view);
 
        xmlFreeDoc (doc);


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