From adf7063e7f4739e5be761c85a2b7de37a013f085 Mon Sep 17 00:00:00 2001 From: "ducarroz%netscape.com" Date: Thu, 7 Mar 2002 03:01:21 +0000 Subject: [PATCH] Fix for bug 129131. Fix regression caused by my previous checkin and add a null pointer check to avoid future crash. R=varada, SR=bienvenu, A=dbaron --- mailnews/mime/src/mimemoz2.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mailnews/mime/src/mimemoz2.cpp b/mailnews/mime/src/mimemoz2.cpp index e2b9e7178e03..dfacf0ec45cf 100644 --- a/mailnews/mime/src/mimemoz2.cpp +++ b/mailnews/mime/src/mimemoz2.cpp @@ -242,10 +242,9 @@ ValidateRealName(nsMsgAttachmentData *aAttach, MimeHeaders *aHdrs) // name. if (aAttach->real_type && !nsCRT::strcasecmp(aAttach->real_type, MESSAGE_RFC822)) { - if (aHdrs->munged_subject) - { + NS_ASSERTION(aHdrs, "How comes the object's headers is null!"); + if (aHdrs && aHdrs->munged_subject) aAttach->real_name = PR_smprintf("%s.eml", aHdrs->munged_subject); - } else NS_MsgSACopy(&(aAttach->real_name), "ForwardedMessage.eml"); return; @@ -533,12 +532,13 @@ MimeGetAttachmentList(MimeObject *tobj, const char *aMessageURL, nsMsgAttachment cobj = (MimeContainer*) obj; n = CountTotalMimeAttachments(cobj); + if (n <= 0) + return n; + //in case of an inline message (as body), we need an extra slot for the message itself //that we will fill later... if (isAnInlineMessage) n ++; - if (n <= 0) - return n; *data = (nsMsgAttachmentData *)PR_Malloc( (n + 1) * sizeof(nsMsgAttachmentData)); if (!*data)