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

This commit is contained in:
ducarroz%netscape.com 2002-03-07 03:01:21 +00:00
Родитель 9ebc3affce
Коммит 1d38a88690
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -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)