Skip to content

Commit

Permalink
Guard against nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 13, 2019
1 parent 2ec429c commit 958dbb1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -80,14 +80,15 @@ QString getFullProjString( PJ *obj )
// see https://lists.osgeo.org/pipermail/proj/2019-May/008565.html, it's not sufficient to just
// use proj_as_proj_string
QgsProjUtils::proj_pj_unique_ptr boundCrs( proj_crs_create_bound_crs_to_WGS84( QgsProjContext::get(), obj, nullptr ) );
if ( const char *proj4src = proj_as_proj_string( QgsProjContext::get(), boundCrs.get(), PJ_PROJ_4, nullptr ) )
if ( boundCrs )
{
return QString( proj4src );
}
else
{
return QString( proj_as_proj_string( QgsProjContext::get(), obj, PJ_PROJ_4, nullptr ) );
if ( const char *proj4src = proj_as_proj_string( QgsProjContext::get(), boundCrs.get(), PJ_PROJ_4, nullptr ) )
{
return QString( proj4src );
}
}

return QString( proj_as_proj_string( QgsProjContext::get(), obj, PJ_PROJ_4, nullptr ) );
}
#endif
//--------------------------
Expand Down

0 comments on commit 958dbb1

Please sign in to comment.