Skip to content

Commit

Permalink
[GRASS] catch new location crash on win
Browse files Browse the repository at this point in the history
Hopefully fixes #28148
  • Loading branch information
blazek committed Feb 26, 2020
1 parent 6e55bd5 commit 4755779
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/plugins/grass/qgsgrassnewmapset.cpp
Expand Up @@ -463,17 +463,23 @@ void QgsGrassNewMapset::setGrassProjection()
// Note: GPJ_osr_to_grass() defaults in PROJECTION_XY if projection
// cannot be set

// There was a bug in GRASS, it is present in 6.0.x line
int ret = GPJ_wkt_to_grass( &mCellHead, &mProjInfo, &mProjUnits, wkt, 0 );

// Note: It seems that GPJ_osr_to_grass()returns always 1,
// -> test if mProjInfo was set

Q_UNUSED( ret )
QgsDebugMsg( QString( "ret = %1" ).arg( ret ) );
QgsDebugMsg( QString( "mProjInfo = %1" ).arg( QString::number( ( qulonglong )mProjInfo, 16 ).toLocal8Bit().constData() ) );

CPLFree( wkt );
G_TRY
{
// There was a bug in GRASS, it is present in 6.0.x line
int ret = GPJ_wkt_to_grass( &mCellHead, &mProjInfo, &mProjUnits, wkt, 0 );
// Note: It seems that GPJ_osr_to_grass()returns always 1,
// -> test if mProjInfo was set

Q_UNUSED( ret )
QgsDebugMsg( QString( "ret = %1" ).arg( ret ) );
QgsDebugMsg( QString( "mProjInfo = %1" ).arg( QString::number( ( qulonglong )mProjInfo, 16 ).toLocal8Bit().constData() ) );
CPLFree( wkt );
}
G_CATCH( QgsGrass::Exception & e )
{
QgsGrass::warning( tr( "Cannot set projection: %1" ).arg( e.what() ) );
return;
}
}

if ( !mProjInfo || !mProjUnits )
Expand Down

0 comments on commit 4755779

Please sign in to comment.