Index: camel/camel-index.c
===================================================================
--- camel/camel-index.c	(revision 7877)
+++ camel/camel-index.c	(working copy)
@@ -115,6 +115,8 @@
 int
 camel_index_rename(CamelIndex *idx, const char *path)
 {
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), -1);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		return CI_CLASS(idx)->rename(idx, path);
 	else {
@@ -126,6 +128,8 @@
 void
 camel_index_set_normalise(CamelIndex *idx, CamelIndexNorm func, void *data)
 {
+	g_return_if_fail (CAMEL_IS_INDEX (idx));
+	
 	idx->normalise = func;
 	idx->normalise_data = data;
 }
@@ -133,6 +137,8 @@
 int
 camel_index_sync(CamelIndex *idx)
 {
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), -1);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		return CI_CLASS(idx)->sync(idx);
 	else {
@@ -144,6 +150,8 @@
 int
 camel_index_compress(CamelIndex *idx)
 {
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), -1);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		return CI_CLASS(idx)->compress(idx);
 	else {
@@ -157,6 +165,8 @@
 {
 	int ret;
 
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), -1);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0) {
 		ret = CI_CLASS(idx)->delete(idx);
 		idx->state |= CAMEL_INDEX_DELETED;
@@ -171,6 +181,8 @@
 int
 camel_index_has_name(CamelIndex *idx, const char *name)
 {
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), FALSE);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		return CI_CLASS(idx)->has_name(idx, name);
 	else
@@ -180,6 +192,8 @@
 CamelIndexName *
 camel_index_add_name(CamelIndex *idx, const char *name)
 {
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), NULL);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		return CI_CLASS(idx)->add_name(idx, name);
 	else
@@ -189,6 +203,8 @@
 int
 camel_index_write_name(CamelIndex *idx, CamelIndexName *idn)
 {
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), -1);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		return CI_CLASS(idx)->write_name(idx, idn);
 	else {
@@ -200,6 +216,8 @@
 CamelIndexCursor *
 camel_index_find_name(CamelIndex *idx, const char *name)
 {
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), NULL);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		return CI_CLASS(idx)->find_name(idx, name);
 	else
@@ -209,6 +227,8 @@
 void
 camel_index_delete_name(CamelIndex *idx, const char *name)
 {
+	g_return_if_fail (CAMEL_IS_INDEX (idx));
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		CI_CLASS(idx)->delete_name(idx, name);
 }
@@ -219,6 +239,8 @@
 	char *b = (char *)word;
 	CamelIndexCursor *ret;
 
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), NULL);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) != 0)
 		return NULL;
 
@@ -236,6 +258,8 @@
 CamelIndexCursor *
 camel_index_words(CamelIndex *idx)
 {
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), NULL);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		return CI_CLASS(idx)->words(idx);
 	else
@@ -245,6 +269,8 @@
 CamelIndexCursor *
 camel_index_names(CamelIndex *idx)
 {
+	g_return_val_if_fail (CAMEL_IS_INDEX (idx), NULL);
+	
 	if ((idx->state & CAMEL_INDEX_DELETED) == 0)
 		return CI_CLASS(idx)->names(idx);
 	else
Index: camel/camel-folder-summary.c
===================================================================
--- camel/camel-folder-summary.c	(revision 7877)
+++ camel/camel-folder-summary.c	(working copy)
@@ -930,6 +930,9 @@
 CamelMessageInfo *
 camel_folder_summary_add_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
 {
+	g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (s), NULL);
+	g_return_val_if_fail (CAMEL_IS_MIME_PARSER (mp), NULL);
+
 	CamelMessageInfo *info = camel_folder_summary_info_new_from_parser(s, mp);
 
 	camel_folder_summary_add(s, info);
