From 23be726b6025c8e1a656840903da15f7d1f3fb37 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 11 Dec 2000 22:05:52 +0000 Subject: return NULL if no {folder,storage} is found. (get_control_for_uri): return * e-shell-view.c (get_type_for_{folder,storage}): return NULL if no {folder,storage} is found. (get_control_for_uri): return NULL if no folder_type is found. svn path=/trunk/; revision=6914 --- shell/ChangeLog | 6 ++++++ shell/e-shell-view.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 170a92e22f..c401b553b6 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,9 @@ +2000-12-11 Dan Winship + + * e-shell-view.c (get_type_for_{folder,storage}): return NULL if + no {folder,storage} is found. + (get_control_for_uri): return NULL if no folder_type is found. + 2000-12-08 Ettore Perazzoli * e-shortcuts-view.c (e_shortcuts_view_construct): Ooops. We were diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 38507668ce..2e14e2966c 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1251,6 +1251,8 @@ get_type_for_storage (EShellView *shell_view, storage_set = e_shell_get_storage_set (priv->shell); storage = e_storage_set_get_storage (storage_set, name); + if (!storage) + return NULL; *physical_uri_return = e_storage_get_toplevel_node_uri (storage); @@ -1271,6 +1273,8 @@ get_type_for_folder (EShellView *shell_view, storage_set = e_shell_get_storage_set (priv->shell); folder = e_storage_set_get_folder (storage_set, path); + if (!folder) + return NULL; *physical_uri_return = e_folder_get_physical_uri (folder); @@ -1311,11 +1315,13 @@ get_control_for_uri (EShellView *shell_view, /* FIXME: This code needs to be made more robust. */ - slash = strchr (path, G_DIR_SEPARATOR); + slash = strchr (path + 1, G_DIR_SEPARATOR); if (slash == NULL || slash[1] == '\0') folder_type = get_type_for_storage (shell_view, path, &physical_uri); else folder_type = get_type_for_folder (shell_view, path, &physical_uri); + if (!folder_type) + return NULL; folder_type_registry = e_shell_get_folder_type_registry (e_shell_view_get_shell (shell_view)); -- cgit v1.2.3