Skip to content

Commit

Permalink
[GRASS] catch fatal error when G_get_gdal_link fails
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Sep 9, 2015
1 parent f9460f9 commit ef1be5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions src/providers/grass/qgsgrass.cpp
Expand Up @@ -2245,15 +2245,24 @@ bool QgsGrass::isExternal( const QgsGrassObject & object )
{
return false;
}
lock();
bool isExternal = false;
QgsGrass::setLocation( object.gisdbase(), object.location() );
struct GDAL_link *gdal;
gdal = G_get_gdal_link( object.name().toUtf8().data(), object.mapset().toUtf8().data() );
if ( gdal )
G_TRY
{
QgsGrass::setLocation( object.gisdbase(), object.location() );
struct GDAL_link *gdal;
gdal = G_get_gdal_link( object.name().toUtf8().data(), object.mapset().toUtf8().data() );
if ( gdal )
{
isExternal = true;
G_close_gdal_link( gdal );
}
}
G_CATCH( QgsGrass::Exception &e )
{
isExternal = true;
G_close_gdal_link( gdal );
QgsDebugMsg( "error getting external link: " + QString(e.what()) );
}
unlock();
return isExternal;
}

Expand Down
2 changes: 1 addition & 1 deletion src/providers/grass/qgsgrassimport.cpp
Expand Up @@ -662,7 +662,7 @@ bool QgsGrassExternal::import()

try
{
QString cmd = "r.external";
QString cmd = QgsGrass::gisbase() + "/bin/r.external";
QStringList arguments;

if ( QFileInfo( mSource ).exists() )
Expand Down

0 comments on commit ef1be5c

Please sign in to comment.