diff options
author | Vincent Richard <[email protected]> | 2013-11-22 12:32:52 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2013-11-22 12:32:52 +0000 |
commit | 96077ce7e6125cdba959925d0a2b7b1f8ee54046 (patch) | |
tree | aa478ebd974ce101e8e16d9c6cbab32643725a31 /src/plainTextPart.cpp | |
parent | Do not throw exception for normal code flow. (diff) | |
download | vmime-96077ce7e6125cdba959925d0a2b7b1f8ee54046.tar.gz vmime-96077ce7e6125cdba959925d0a2b7b1f8ee54046.zip |
Do not throw exception for normal code flow (exceptions::no_such_field).
Diffstat (limited to 'src/plainTextPart.cpp')
-rw-r--r-- | src/plainTextPart.cpp | 23 |
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. } } |