aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2015-02-16 18:42:46 +0000
committerVincent Richard <[email protected]>2015-02-16 19:36:10 +0000
commit1ceda54bb941859d2e55ddc8a8a10e420adaaf3f (patch)
treed032b7ff17d4c9a6642c032341d3c3d35bc3ee7f
parentIssue #103: fix badly encoded words. (diff)
downloadvmime-1ceda54bb941859d2e55ddc8a8a10e420adaaf3f.tar.gz
vmime-1ceda54bb941859d2e55ddc8a8a10e420adaaf3f.zip
Skip word on unexpected error when fixing broken words.
-rw-r--r--src/vmime/text.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/vmime/text.cpp b/src/vmime/text.cpp
index f506f660..0722be02 100644
--- a/src/vmime/text.cpp
+++ b/src/vmime/text.cpp
@@ -423,7 +423,17 @@ void text::fixBrokenWords(std::vector <shared_ptr <word> >& words)
shared_ptr <word> w2 = words[i + 1];
// Check whether the word is valid
- bool valid = w1->getCharset().isValidText(w1->getBuffer(), NULL);
+ bool valid = false;
+
+ try
+ {
+ valid = w1->getCharset().isValidText(w1->getBuffer(), NULL);
+ }
+ catch (vmime::exceptions::charset_conv_error& e)
+ {
+ // Unknown charset or unexpected conversion error: assume word is valid
+ valid = true;
+ }
// If the current word is not valid, try to grab some bytes
// from the next word, to see whether it becomes valid.