Skip to content

Commit

Permalink
Don't try to intrepret an empty string as a CRS
Browse files Browse the repository at this point in the history
We'll never succeed, so it's just a waste of resources
  • Loading branch information
nyalldawson committed Jun 10, 2020
1 parent 8192be7 commit 0dc513c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -271,6 +271,9 @@ bool QgsCoordinateReferenceSystem::createFromId( const long id, CrsType type )

bool QgsCoordinateReferenceSystem::createFromString( const QString &definition )
{
if ( definition.isEmpty() )
return false;

QgsReadWriteLocker locker( *sCrsStringLock(), QgsReadWriteLocker::Read );
if ( !sDisableStringCache )
{
Expand Down Expand Up @@ -336,6 +339,9 @@ bool QgsCoordinateReferenceSystem::createFromString( const QString &definition )

bool QgsCoordinateReferenceSystem::createFromUserInput( const QString &definition )
{
if ( definition.isEmpty() )
return false;

QString userWkt;
OGRSpatialReferenceH crs = OSRNewSpatialReference( nullptr );

Expand Down Expand Up @@ -381,6 +387,9 @@ void QgsCoordinateReferenceSystem::setupESRIWktFix()

bool QgsCoordinateReferenceSystem::createFromOgcWmsCrs( const QString &crs )
{
if ( crs.isEmpty() )
return false;

QgsReadWriteLocker locker( *sOgcLock(), QgsReadWriteLocker::Read );
if ( !sDisableOgcCache )
{
Expand Down Expand Up @@ -829,6 +838,9 @@ bool QgsCoordinateReferenceSystem::hasAxisInverted() const

bool QgsCoordinateReferenceSystem::createFromWkt( const QString &wkt )
{
if ( wkt.isEmpty() )
return false;

d.detach();

QgsReadWriteLocker locker( *sCRSWktLock(), QgsReadWriteLocker::Read );
Expand Down Expand Up @@ -899,6 +911,9 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )

bool QgsCoordinateReferenceSystem::createFromProj( const QString &projString, const bool identify )
{
if ( projString.isEmpty() )
return false;

d.detach();

if ( projString.trimmed().isEmpty() )
Expand Down

0 comments on commit 0dc513c

Please sign in to comment.