Skip to content

Commit

Permalink
Fix crash when opening CSV with wrong codec
Browse files Browse the repository at this point in the history
Fix #46219
  • Loading branch information
elpaso authored and github-actions[bot] committed Dec 3, 2021
1 parent 950049b commit feabc72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/providers/delimitedtext/qgsdelimitedtextfile.cpp
Expand Up @@ -90,6 +90,11 @@ bool QgsDelimitedTextFile::open()
if ( mFile )
{
mCodec = QTextCodec::codecForName( !mEncoding.isEmpty() ? mEncoding.toLatin1() : "UTF-8" );
if ( ! mCodec )
{
QgsDebugMsgLevel( "Data file " + mFileName + " could not be opened: wrong codec.", 2 );
return false;
}
if ( mUseWatcher )
{
mWatcher = new QFileSystemWatcher();
Expand Down

0 comments on commit feabc72

Please sign in to comment.