Skip to content
Permalink
Browse files

[GRASS] catch fatal error in mapRegion()

  • Loading branch information
blazek committed Aug 31, 2015
1 parent a4f5d9a commit c0d51d17ed95ac13e621567d5b80ec067ca35af7
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/providers/grass/qgsgrass.cpp
@@ -1618,17 +1618,24 @@ bool QgsGrass::mapRegion( QgsGrassObject::Type type, QString gisdbase,
if ( type == QgsGrassObject::Raster )
{

QString error = tr( "Cannot read raster map region" ) + " (" + gisdbase + "/" + location + "/" + mapset + ")";
#if GRASS_VERSION_MAJOR < 7
if ( G_get_cellhd( map.toUtf8().data(),
mapset.toUtf8().data(), window ) < 0 )
{
QMessageBox::warning( 0, QObject::tr( "Warning" ),
QObject::tr( "Cannot read raster map region" ) );
warning( error );
return false;
}
#else
// TODO7: unfortunately Rast_get_cellhd does not return error code and calls G_fatal_error on error
Rast_get_cellhd( map.toUtf8().data(), mapset.toUtf8().data(), window );
G_TRY
{
Rast_get_cellhd( map.toUtf8().data(), mapset.toUtf8().data(), window );
}
G_CATCH( QgsGrass::Exception &e )
{
warning( error + " : " + e.what() );
return false;
}
#endif
}
else if ( type == QgsGrassObject::Vector )

0 comments on commit c0d51d1

Please sign in to comment.
You can’t perform that action at this time.