Skip to content

Commit

Permalink
Browser: fix GPKG sublayers and empty DBs
Browse files Browse the repository at this point in the history
Fixes #37519
  • Loading branch information
elpaso authored and nyalldawson committed Jul 1, 2020
1 parent 9360515 commit 9b13534
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/providers/ogr/qgsogrdataitems.cpp
Expand Up @@ -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
{
Expand Down

0 comments on commit 9b13534

Please sign in to comment.