Index: pop3.c
===================================================================
RCS file: /cvsroot/mahogany/M/extra/src/c-client/pop3.c,v
retrieving revision 1.10
diff -b -u -5 -r1.10 pop3.c
--- pop3.c      22 Jun 2001 20:26:57 -0000      1.10
+++ pop3.c      18 Sep 2002 13:02:06 -0000
@@ -653,10 +653,17 @@
       LOCAL->msgno = elt->msgno;/* set as current message number */
                                /* load the cache */
       LOCAL->txt = netmsg_slurp (LOCAL->netstream,&elt->rfc822_size,
                                 &LOCAL->hdrsize);
 /*** MAHOGANY PATCH ***/
+      if (LOCAL->hdrsize == 0) {
+         // How could we have a message without headers ?
+         if (LOCAL->txt) fclose (LOCAL->txt);
+         LOCAL->txt = NIL;
+         LOCAL->msgno = LOCAL->hdrsize = 0;
+         return LOCAL->hdrsize;
+      }
       LOCAL->hasbody = T;
 /*** END OF MAHOGANY PATCH ***/
     }
     else elt->deleted = T;
   }
Index: mail.c
===================================================================
RCS file: /cvsroot/mahogany/M/extra/src/c-client/mail.c,v
retrieving revision 1.8
diff -b -u -5 -r1.8 mail.c
--- mail.c      19 Jun 2001 13:35:07 -0000      1.8
+++ mail.c      18 Sep 2002 13:02:16 -0000
@@ -1200,12 +1200,16 @@
       hdr[hdrsize] = '\0';     /* tie off header */

       /*** MAHOGANY PATCH ***/
       /* don't retrieve the entire body to just get the size of the header for
          POP3 driver, this is *awfully* inefficient */
-      if (body || !elt->rfc822_size)
-        (*stream->dtb->text) (stream,msgno,&bs,(flags & ~FT_INTERNAL) | FT_PEEK);
+      if (body || !elt->rfc822_size) {
+        long rc = (*stream->dtb->text) (stream,msgno,&bs,(flags & ~FT_INTERNAL) | FT_PEEK);
+        if (rc == NIL) {
+           return NIL;
+        }
+      }
       /*** END OF MAHOGANY PATCH ***/
       if (!elt->rfc822_size) elt->rfc822_size = hdrsize + SIZE (&bs);
       if (body)                        /* only parse body if requested */
        rfc822_parse_msg (env,b,hdr,hdrsize,&bs,BADHOST,stream->dtb->flags);
       else

