Index: camel/camel-object.c
===================================================================
--- camel/camel-object.c	(revision 8404)
+++ camel/camel-object.c	(working copy)
@@ -1067,6 +1067,7 @@ camel_object_cast(CamelObject *o, CamelT
 {
 	CamelObjectClass *k;
 
+	g_return_val_if_fail(o != NULL, NULL);
 	g_return_val_if_fail(check_magic(o, ctype, CAMEL_OBJECT_MAGIC), NULL);
 
 	k = o->klass;
