Commit f65f0b00 authored by VDVsx's avatar VDVsx

Merge pull request #77 from nemomobile-packages/nilBoundaries

[imap] Gracefully handle bodystructure where boundaries are reported as NIL
parents 1378d062 71c77ea2
......@@ -3948,8 +3948,13 @@ const QMailMessagePart& QMailMessagePartContainerPrivate::partAt(const QMailMess
const QList<QMailMessagePart>* partList = &_messageParts;
foreach (uint index, location.d->_indices) {
part = &(partList->at(index - 1));
partList = &(part->impl<const QMailMessagePartContainerPrivate>()->_messageParts);
if (index >= 0 && index <= partList->size()) {
part = &(partList->at(index - 1));
partList = &(part->impl<const QMailMessagePartContainerPrivate>()->_messageParts);
} else {
qMailLog(Messaging) << Q_FUNC_INFO << "Invalid index, container does not have a part at " << index;
Q_ASSERT(false);
}
}
Q_ASSERT(part);
......@@ -3962,8 +3967,13 @@ QMailMessagePart& QMailMessagePartContainerPrivate::partAt(const QMailMessagePar
QList<QMailMessagePart>* partList = &_messageParts;
foreach (uint index, location.d->_indices) {
part = &((*partList)[index - 1]);
partList = &(part->impl<QMailMessagePartContainerPrivate>()->_messageParts);
if (index >= 0 && index <= partList->size()) {
part = &((*partList)[index - 1]);
partList = &(part->impl<QMailMessagePartContainerPrivate>()->_messageParts);
} else {
qMailLog(Messaging) << Q_FUNC_INFO << "Invalid index, container does not have a part at " << index;
Q_ASSERT(false);
}
}
return *part;
......
......@@ -435,7 +435,12 @@ void setMultipartFromDescription(const QStringList &structure, QMailMessagePartC
}
for ( ; (it != end) && ((it + 1) != end); it += 2) {
if ((*it).trimmed().toUpper() == "BOUNDARY") {
container->setBoundary((*(it + 1)).toLatin1());
const QString boundary((*(it + 1)));
if (boundary.toUpper() == "NIL") {
container->setBoundary(QByteArray());
} else {
container->setBoundary(boundary.toLatin1());
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment