From: Jose Dapena Paz Date: Mon, 20 Jul 2009 08:54:32 +0000 (+0200) Subject: Check some error conditions in modest_tny_folder_find_folder_from_uri (fix 2 for... X-Git-Tag: 3.0.17-rc25~18 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=aa4a7c963f9e82309d238fea09984cbea14c267f Check some error conditions in modest_tny_folder_find_folder_from_uri (fix 2 for NB#126941) --- diff --git a/src/modest-tny-folder.c b/src/modest-tny-folder.c index 2c0442f..8e39657 100644 --- a/src/modest-tny-folder.c +++ b/src/modest-tny-folder.c @@ -538,11 +538,17 @@ modest_tny_folder_store_find_folder_from_uri (TnyFolderStore *folder_store, cons gchar *uri_to_find, *slash; gint uri_lenght; + if (uri == NULL) + return NULL; + + slash = strrchr (uri, '/'); + if (slash == NULL) + return NULL; + result = NULL; children = TNY_LIST (tny_simple_list_new ()); tny_folder_store_get_folders (folder_store, children, NULL, FALSE, NULL); - slash = strrchr (uri, '/'); uri_lenght = slash - uri + 1; uri_to_find = g_malloc0 (sizeof(char) * uri_lenght); strncpy (uri_to_find, uri, uri_lenght); @@ -554,6 +560,8 @@ modest_tny_folder_store_find_folder_from_uri (TnyFolderStore *folder_store, cons TnyFolderStore *child; child = TNY_FOLDER_STORE (tny_iterator_get_current (iterator)); + if (!child) + continue; if (TNY_IS_FOLDER (child)) { gchar *folder_url;