Bug 262265 chmlib should not send qFatal if encoding could not be guessed

Okular sends a 'qFatal()', if no encoding could be guessed. This will also create a core dump crashing Okular and all open document in this instance.

Bugs closed: 262265

Reviewed at https://git.reviewboard.kde.org/r/130106/
This commit is contained in:
Gilbert Assaf 2017-05-31 13:02:20 +02:00
parent 357f198c1e
commit e876640c21

View file

@ -101,7 +101,8 @@ bool LCHMFileImpl::loadFile( const QString & archiveName )
// and guess the encoding
getInfoFromWindows();
getInfoFromSystem();
guessTextEncoding();
if ( !guessTextEncoding() )
return false;
// Check whether the search tables are present
if ( ResolveObject(QStringLiteral("/#TOPICS"), &m_chmTOPICS)
@ -1192,8 +1193,11 @@ bool LCHMFileImpl::guessTextEncoding( )
const LCHMTextEncoding * enc = 0;
if ( !m_detectedLCID || (enc = lookupByLCID (m_detectedLCID)) == 0 )
qFatal ("Could not detect text encoding by LCID");
{
qWarning ("Could not detect text encoding by LCID");
return false;
}
if ( changeFileEncoding (enc->qtcodec) )
{
m_currentEncoding = enc;