Index: camel/providers/imap/camel-imap-utils.c
===================================================================
--- camel/providers/imap/camel-imap-utils.c	(revision 8187)
+++ camel/providers/imap/camel-imap-utils.c	(working copy)
@@ -989,7 +989,7 @@
 			/* envelope */
 			imap_skip_list (&inptr);
 			
-			if (*inptr++ != ' ')
+			if (!inptr || *inptr++ != ' ')
 				goto exception;
 			
 			/* body */
@@ -997,14 +997,14 @@
 				goto exception;
 			child->parent = ci;
 			
-			if (*inptr++ != ' ')
+			if (!inptr || *inptr++ != ' ')
 				goto exception;
 			
 			/* lines */
 			strtoul ((const char *) inptr, &p, 10);
 			inptr = (const unsigned char *) p;
 		} else if (camel_content_type_is (ctype, "text", "*")) {
-			if (*inptr++ != ' ')
+			if (!inptr || *inptr++ != ' ')
 				goto exception;
 			
 			/* lines */
@@ -1014,7 +1014,7 @@
 			/* body_type_basic */
 		}
 		
-		if (*inptr++ != ')')
+		if (!inptr || *inptr++ != ')')
 			goto exception;
 		
 		ci->type = ctype;
Index: camel/providers/imap/ChangeLog
===================================================================
--- camel/providers/imap/ChangeLog	(revision 8187)
+++ camel/providers/imap/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2007-11-08  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #495086
+
+	* camel-imap-utils.c: (imap_body_decode):
+	Check for NULL too, so do not crash when something goes wrong.
+
 2007-11-05  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #430420
