Skip to content

Commit c16e5ee

Browse files
committedMay 20, 2019
Fix a crash under proj 6
1 parent 0c05568 commit c16e5ee

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎src/core/qgscoordinatetransform_p.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,16 @@ ProjData QgsCoordinateTransformPrivate::threadLocalProjData()
284284
#if PROJ_VERSION_MAJOR>=6
285285
#if PROJ_VERSION_MINOR>=1
286286
QgsProjUtils::proj_pj_unique_ptr transform( proj_create_crs_to_crs( context, mSourceProjString.toUtf8().constData(), mDestProjString.toUtf8().constData(), nullptr ) );
287+
if ( !transform )
288+
{
289+
// ouch!
290+
return nullptr;
291+
}
292+
287293
// transform may have either the source or destination CRS using swapped axis order. For QGIS, we ALWAYS need regular x/y axis order
288294
ProjData res = proj_normalize_for_visualization( context, transform.get() );
289295
mProjProjections.insert( reinterpret_cast< uintptr_t>( context ), res );
296+
290297
#else
291298
// proj 6.0 does not have proj_normalize_for_visualization - we have to handle this manually and inefficiently!
292299
ProjData res = proj_create_crs_to_crs( context, mSourceProjString.toUtf8().constData(), mDestProjString.toUtf8().constData(), nullptr );

0 commit comments

Comments
 (0)
Please sign in to comment.