Skip to content

Commit

Permalink
[GRASS] fixed crash when GISRC is set but file does not exist or it i…
Browse files Browse the repository at this point in the history
…s corrupted
  • Loading branch information
blazek committed May 21, 2015
1 parent e8587c3 commit 8c8a123
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/providers/grass/qgsgrass.cpp
Expand Up @@ -237,17 +237,21 @@ void GRASS_LIB_EXPORT QgsGrass::init( void )
QSettings settings;

// Is it active mode ?
active = false;
if ( getenv( "GISRC" ) )
{
active = true;
// Store default values
defaultGisdbase = G_gisdbase();
defaultLocation = G_location();
defaultMapset = G_mapset();
}
else
{
active = false;
G_TRY
{
// Store default values
defaultGisdbase = G_gisdbase();
defaultLocation = G_location();
defaultMapset = G_mapset();
active = true;
}
G_CATCH( QgsGrass::Exception &e )
{
QgsDebugMsg( QString( "GISRC set but cannot get gisdbase/location/mapset: %1" ).arg( e.what() ) );
}
}

// Don't use GISRC file and read/write GRASS variables (from location G_VAR_GISRC) to memory only.
Expand Down

0 comments on commit 8c8a123

Please sign in to comment.