Commit a6412022 authored by Allen Winter's avatar Allen Winter
Browse files

in parts(), add a crash guard against an empty KMime::Message payload

BUG: 291902
MERGE: 4.8
FIXED-IN: 4.8.1
(cherry picked from commit b1b24440)
parent f547077a
......@@ -186,17 +186,25 @@ void SerializerPluginMail::serialize( const Item& item, const QByteArray& label,
}
}
QSet<QByteArray> SerializerPluginMail::parts(const Item & item) const
QSet<QByteArray> SerializerPluginMail::parts( const Item &item ) const
{
if ( !item.hasPayload<KMime::Message::Ptr>() )
return QSet<QByteArray>();
KMime::Message::Ptr msg = item.payload<KMime::Message::Ptr>();
QSet<QByteArray> set;
// FIXME: we actually want "has any header" here, but the kmime api doesn't offer that yet
if ( !item.hasPayload<KMime::Message::Ptr>() ) {
return set;
}
KMime::Message::Ptr msg = item.payload<KMime::Message::Ptr>();
if ( !msg ) {
return set;
}
// FIXME: we really want "has any header" here, but the kmime api doesn't offer that yet
if ( msg->hasContent() || msg->hasHeader( "Message-ID" ) ) {
set << MessagePart::Envelope << MessagePart::Header;
if ( !msg->body().isEmpty() || !msg->contents().isEmpty() )
if ( !msg->body().isEmpty() || !msg->contents().isEmpty() ) {
set << MessagePart::Body;
}
}
return set;
}
......
Supports Markdown
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