Skip to content

Commit 958dbb1

Browse files
committedMay 13, 2019
Guard against nullptr
1 parent 2ec429c commit 958dbb1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
 

‎src/core/qgscoordinatereferencesystem.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,15 @@ QString getFullProjString( PJ *obj )
8080
// see https://lists.osgeo.org/pipermail/proj/2019-May/008565.html, it's not sufficient to just
8181
// use proj_as_proj_string
8282
QgsProjUtils::proj_pj_unique_ptr boundCrs( proj_crs_create_bound_crs_to_WGS84( QgsProjContext::get(), obj, nullptr ) );
83-
if ( const char *proj4src = proj_as_proj_string( QgsProjContext::get(), boundCrs.get(), PJ_PROJ_4, nullptr ) )
83+
if ( boundCrs )
8484
{
85-
return QString( proj4src );
86-
}
87-
else
88-
{
89-
return QString( proj_as_proj_string( QgsProjContext::get(), obj, PJ_PROJ_4, nullptr ) );
85+
if ( const char *proj4src = proj_as_proj_string( QgsProjContext::get(), boundCrs.get(), PJ_PROJ_4, nullptr ) )
86+
{
87+
return QString( proj4src );
88+
}
9089
}
90+
91+
return QString( proj_as_proj_string( QgsProjContext::get(), obj, PJ_PROJ_4, nullptr ) );
9192
}
9293
#endif
9394
//--------------------------

0 commit comments

Comments
 (0)