From 310189326247ec07951b30c52abc69050be5d2b9 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sun, 14 May 2000 14:00:09 +0000 Subject: Protect against unknown folder types better. svn path=/trunk/; revision=3025 --- shell/ChangeLog | 7 +++++++ shell/e-folder-type-repository.c | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/shell/ChangeLog b/shell/ChangeLog index 4f0924778d..e692ac0cf3 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,10 @@ +2000-05-14 Ettore Perazzoli + + * e-folder-type-repository.c + (e_folder_type_repository_get_control_id_for_type): Protect + against non-existing types. + (e_folder_type_repository_get_icon_for_type): Likewise. + 2000-05-14 Ettore Perazzoli * e-storage-set-view.c diff --git a/shell/e-folder-type-repository.c b/shell/e-folder-type-repository.c index d53c0d95d7..c96ab5a5b6 100644 --- a/shell/e-folder-type-repository.c +++ b/shell/e-folder-type-repository.c @@ -231,6 +231,11 @@ e_folder_type_repository_get_icon_name_for_type (EFolderTypeRepository *folder_t g_return_val_if_fail (type_name != NULL, NULL); folder_type = get_folder_type (folder_type_repository, type_name); + if (folder_type == NULL) { + g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name); + return NULL; + } + return folder_type->icon_name; } @@ -245,6 +250,11 @@ e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_r g_return_val_if_fail (type_name != NULL, NULL); folder_type = get_folder_type (folder_type_repository, type_name); + if (folder_type == NULL) { + g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name); + return NULL; + } + return folder_type->icon_pixbuf; } @@ -259,6 +269,11 @@ e_folder_type_repository_get_control_id_for_type (EFolderTypeRepository *folder_ g_return_val_if_fail (type_name != NULL, NULL); folder_type = get_folder_type (folder_type_repository, type_name); + if (folder_type == NULL) { + g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name); + return NULL; + } + return folder_type->control_id; } -- cgit