fix bug 2086

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10556 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2005-10-17 08:30:37 +00:00
parent 0688b5face
commit 56c6e2f621
2 changed files with 20 additions and 14 deletions

View File

@ -1,3 +1,7 @@
2005-10-16 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* QLyXKeySym.C (initEncodings): prevent crash when no codec found
2005-10-07 Martin Vermeer <martin.vermeer@hut.fi>
* QContentPane.C (QContentPane): make times 50 msec instead of 25,

View File

@ -45,19 +45,22 @@ char const encode(string const & encoding, QString const & str)
EncodingMap::const_iterator cit = encoding_map.find(encoding);
if (cit == encoding_map.end()) {
if (lyxerr.debugging())
lyxerr[Debug::KEY] << "Unrecognised encoding "
<< encoding << endl;
lyxerr[Debug::KEY] << "Unrecognised encoding '" << encoding
<< "'." << endl;
codec = encoding_map.find("")->second;
} else {
codec = cit->second;
}
if (lyxerr.debugging())
if (!codec) {
lyxerr[Debug::KEY] << "No codec for encoding '" << encoding
<< "' found." << endl;
return 0;
}
lyxerr[Debug::KEY] << "Using codec " << fromqstr(codec->name()) << endl;
if (!codec->canEncode(str)) {
if (lyxerr.debugging())
lyxerr[Debug::KEY] << "Oof. Can't encode the text !" << endl;
return 0;
}
@ -118,8 +121,7 @@ void initEncodings()
lyxerr << "Language code:" << s << endl;
for (Languages::const_iterator it=languages.begin(); it != languages.end(); ++it) {
//lyxerr << it->second.code() << ":" << it->second.encodingStr() << ":" << it->second.encoding() << endl;
if (it->second.code() == s)
{
if (it->second.code() == s) {
s = it->second.encodingStr();
break;
}