From ca899cf1cbed85d333e19437512aab63dd866a0e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 14 Dec 2009 13:15:57 -0500 Subject: Make e_shell_window_update_search_menu() more crash-resistant. --- shell/e-shell-window-actions.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index df96043076..03fa5379eb 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -2226,12 +2226,21 @@ e_shell_window_update_search_menu (EShellWindow *shell_window) guint merge_id; gint ii = 0; + g_return_if_fail (E_IS_SHELL_WINDOW (shell_window)); + ui_manager = e_shell_window_get_ui_manager (shell_window); view_name = e_shell_window_get_active_view (shell_window); shell_view = e_shell_window_get_shell_view (shell_window, view_name); + + /* Check for a NULL shell view before proceeding. This can + * happen if the initial view name from GConf is unrecognized. + * Without this we would crash at E_SHELL_VIEW_GET_CLASS(). */ + g_return_if_fail (shell_view != NULL); + shell_content = e_shell_view_get_shell_content (shell_view); context = e_shell_content_get_search_context (shell_content); shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); + source = E_FILTER_SOURCE_INCOMING; /* Update sensitivity of search actions. */ -- cgit v1.2.3