aboutsummaryrefslogtreecommitdiffstats
path: root/src/plainTextPart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plainTextPart.cpp')
-rw-r--r--src/plainTextPart.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/plainTextPart.cpp b/src/plainTextPart.cpp
index e1959af1..bdb76c4d 100644
--- a/src/plainTextPart.cpp
+++ b/src/plainTextPart.cpp
@@ -75,20 +75,23 @@ void plainTextPart::parse(shared_ptr <const bodyPart> /* message */,
{
m_text = vmime::clone(textPart->getBody()->getContents());
- try
- {
- const contentTypeField& ctf =
- *textPart->getHeader()->findField <contentTypeField>(fields::CONTENT_TYPE);
+ shared_ptr <const contentTypeField> ctf =
+ textPart->getHeader()->findField <contentTypeField>(fields::CONTENT_TYPE);
- m_charset = ctf.getCharset();
- }
- catch (exceptions::no_such_field&)
+ if (ctf)
{
- // No "Content-type" field.
+ try
+ {
+ m_charset = ctf->getCharset();
+ }
+ catch (exceptions::no_such_parameter&)
+ {
+ // No "charset" parameter.
+ }
}
- catch (exceptions::no_such_parameter&)
+ else
{
- // No "charset" parameter.
+ // No "Content-type" field.
}
}