diff options
-rw-r--r-- | camel/ChangeLog | 13 | ||||
-rw-r--r-- | camel/providers/nntp/camel-nntp-folder.c | 16 | ||||
-rw-r--r-- | camel/providers/nntp/camel-nntp-newsrc.c | 8 |
3 files changed, 31 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index d072116729..48d8dbf1c0 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,4 +1,17 @@ 2000-08-21 JP Rosevear <jpr@helixcode.com> + + * providers/nntp/camel-nntp-folder.c (nntp_folder_get_subfolder_names): + Make sure newsrc is not null + (nntp_folder_get_subfolder_names): ditto + + * providers/nntp/camel-nntp-newsrc.c + (camel_nntp_newsrc_get_subscribed_group_names): Programming check + for newsrc == NULL + (camel_nntp_newsrc_get_all_group_names): ditto + (camel_nntp_newsrc_write_to_file): ditto + (camel_nntp_newsrc_write): ditto + +2000-08-21 JP Rosevear <jpr@helixcode.com> * providers/nntp/camel-nntp-store.c (camel_nntp_command): Make sure respbuffer is not null before manipulating it. diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index 87d401caca..091d35e591 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -131,7 +131,9 @@ nntp_folder_sync (CamelFolder *folder, gboolean expunge, camel_folder_summary_save (CAMEL_NNTP_FOLDER(folder)->summary); store = CAMEL_NNTP_STORE (camel_folder_get_parent_store (folder)); - camel_nntp_newsrc_write (store->newsrc); + + if (store->newsrc) + camel_nntp_newsrc_write (store->newsrc); } static CamelFolder* @@ -309,12 +311,14 @@ nntp_folder_get_subfolder_names (CamelFolder *folder) { if (!strcmp (folder->name, "/")) { CamelStore *store = camel_folder_get_parent_store (folder); - GPtrArray *array = camel_nntp_newsrc_get_subscribed_group_names (CAMEL_NNTP_STORE (store)->newsrc); - return array; - } - else { - return NULL; + + if (CAMEL_NNTP_STORE (store)->newsrc) { + GPtrArray *array = camel_nntp_newsrc_get_subscribed_group_names (CAMEL_NNTP_STORE (store)->newsrc); + return array; + } } + + return NULL; } static void diff --git a/camel/providers/nntp/camel-nntp-newsrc.c b/camel/providers/nntp/camel-nntp-newsrc.c index fc0f4c2a1a..81594d3dcd 100644 --- a/camel/providers/nntp/camel-nntp-newsrc.c +++ b/camel/providers/nntp/camel-nntp-newsrc.c @@ -229,6 +229,8 @@ camel_nntp_newsrc_get_subscribed_group_names (CamelNNTPNewsrc *newsrc) { struct newsrc_ptr_array npa; + g_return_val_if_fail (newsrc, NULL); + npa.ptr_array = g_ptr_array_new(); npa.subscribed_only = TRUE; @@ -243,6 +245,8 @@ camel_nntp_newsrc_get_all_group_names (CamelNNTPNewsrc *newsrc) { struct newsrc_ptr_array npa; + g_return_val_if_fail (newsrc, NULL); + npa.ptr_array = g_ptr_array_new(); npa.subscribed_only = FALSE; @@ -338,6 +342,8 @@ camel_nntp_newsrc_write_to_file(CamelNNTPNewsrc *newsrc, FILE *fp) { struct newsrc_fp newsrc_fp; + g_return_if_fail (newsrc); + newsrc_fp.newsrc = newsrc; newsrc_fp.fp = fp; @@ -351,6 +357,8 @@ camel_nntp_newsrc_write(CamelNNTPNewsrc *newsrc) { FILE *fp; + g_return_if_fail (newsrc); + if (!newsrc->dirty) return; |