Browser: fix GPKG sublayers and empty DBs

Fixes #37519
This commit is contained in:
Alessandro Pasotti 2020-07-01 16:34:48 +02:00 committed by Nyall Dawson
parent 9360515dc3
commit 9b13534c5d

View File

@ -237,14 +237,14 @@ QList<QgsOgrDbLayerInfo *> QgsOgrLayerItem::subLayers( const QString &path, cons
}
// There were problems in reading the file: throw
if ( ! layer.isValid() && ! rlayer.isValid() )
if ( ! layer.isValid() && ! rlayer.isValid() && children.isEmpty() )
{
QString errorMessage;
// If it is file based and the file exists, there might be a permission error, let's change
// the message to give the user a hint about this possiblity.
if ( QFile::exists( path ) )
{
errorMessage = tr( "Error opening file, check file and directory permissions on\n%1" ).arg( QDir::toNativeSeparators( path ) );
errorMessage = tr( "The file does not contain any layer or there was an error opening the file.\nCheck file and directory permissions on\n%1" ).arg( QDir::toNativeSeparators( path ) );
}
else
{