diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 43750ed6c64a9d7cf45cdcbb0667d6085065f478..6c3d1e53113b0f27819a9a67d9ecfe47ed3bef5c 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -4650,7 +4650,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc mail_fetchstructure (vms->mailstream,vms->msgArray[vms->curmsg],&body); /* We have the body, now we extract the file name of the first attachment. */ - if (body->nested.part->next && body->nested.part->next->body.parameter->value) { + if (body->nested.part && body->nested.part->next && body->nested.part->next->body.parameter->value) { attachedfilefmt = ast_strdupa(body->nested.part->next->body.parameter->value); } else { ast_log(LOG_ERROR, "There is no file attached to this IMAP message.\n"); @@ -5049,7 +5049,7 @@ static int imap_retrieve_file (char *dir, int msgnum, char *mailbox, char *conte for (i = 0; i < vms_p->mailstream->nmsgs; i++) { mail_fetchstructure(vms_p->mailstream, i + 1, &body); /* We have the body, now we extract the file name of the first attachment. */ - if (body->nested.part->next && body->nested.part->next->body.parameter->value) { + if (body->nested.part && body->nested.part->next && body->nested.part->next->body.parameter->value) { attachment = ast_strdupa(body->nested.part->next->body.parameter->value); } else { ast_log(LOG_ERROR, "There is no file attached to this IMAP message.\n");