From e8aa23866a44d1d93750f42a9c168bcd007eb7bb Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Tue, 17 Jul 2001 21:22:20 +0000 Subject: Clean up some exception misusage. 2001-07-17 Peter Williams Clean up some exception misusage. * providers/imap/camel-imap-command.c (camel_imap_command): Use our own internal exception for sending the string and transfer it to @ex if anything goes wrong. (imap_read_response): Use our own internal exception for reading the untagged responses and blah blah blah. * camel-session.c (get_service): Use our own internal exception when constructing the service and transfer it to @ex if anything goes wrong. * camel-remote-store.c (remote_recv_line): Instead of having gboolean exception, use our own internal exception and copy it to @ex if anything goes wrong. * camel-store.c (store_sync): Create an internal exception because sync_folder() checks it for validity. Transfer it to @ex when done. * camel-exception.c (camel_exception_get_description): If @ex is NULL, complain - passing NULL exceptions to Camel is okay, but there should be no circumstances under which they're then examined. (camel_exception_get_id): Same here, (camel_exception_xfer): NULL-protect and warn if transferring from a NULL exception. svn path=/trunk/; revision=11177 --- camel/camel-exception.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'camel/camel-exception.c') diff --git a/camel/camel-exception.c b/camel/camel-exception.c index 83389c5588..3ae8d74f77 100644 --- a/camel/camel-exception.c +++ b/camel/camel-exception.c @@ -227,6 +227,17 @@ void camel_exception_xfer (CamelException *ex_dst, CamelException *ex_src) { + if (ex_src == NULL) { + g_warning ("camel_exception_xfer: trying to transfer NULL exception to %p\n", ex_dst); + return; + } + + if (ex_dst == NULL) { + /* must have same side-effects */ + camel_exception_clear (ex_src); + return; + } + CAMEL_EXCEPTION_LOCK(exception); if (ex_dst->desc) @@ -255,8 +266,10 @@ camel_exception_get_id (CamelException *ex) { if (ex) return ex->id; - else + else { + g_warning ("camel_exception_get_id called with NULL parameter."); return CAMEL_EXCEPTION_NONE; + } } /** @@ -276,6 +289,8 @@ camel_exception_get_description (CamelException *ex) if (ex) ret = ex->desc; - + else + g_warning ("camel_exception_get_description called with NULL parameter."); + return ret; } -- cgit v1.2.3