From e5165cdbdc9c56a99edf88dc73143b28728b1e2d Mon Sep 17 00:00:00 2001 From: Reuben Green Date: Tue, 28 Apr 2020 00:12:52 +0100 Subject: [PATCH] prevent thunar crashing if "default-view" or "last-view" properties have bad values --- thunar/thunar-window.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index da0fb3b6..3e619c13 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -3516,16 +3516,17 @@ thunar_window_set_current_directory (ThunarWindow *window, g_free (type_name); /* determine the last selected view if the last selected view preference is not selected */ - if (g_type_is_a (type, G_TYPE_NONE)) + if (g_type_is_a (type, G_TYPE_NONE) || g_type_is_a (type, G_TYPE_INVALID)) { g_object_get (G_OBJECT (window->preferences), "last-view", &type_name, NULL); type = g_type_from_name (type_name); g_free (type_name); - - /* fallback, in nothing was set */ - if (g_type_is_a (type, G_TYPE_NONE)) - type = THUNAR_TYPE_ICON_VIEW; } + + /* fallback, in case nothing was set */ + if (g_type_is_a (type, G_TYPE_NONE) || g_type_is_a (type, G_TYPE_INVALID)) + type = THUNAR_TYPE_ICON_VIEW; + thunar_window_action_view_changed (window, type); } -- 2.26.2