Skip to content

Commit 6096e5c

Browse files
committedFeb 12, 2018
Fix crash after running GDAL alg from processing (fixes #18004)
This was happening only with GDAL trunk Processing first tries to load output as a vector, then as a raster and output from raster algs would crash in OGR provider constructor due to null pointer
1 parent a7870af commit 6096e5c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎src/providers/ogr/qgsogrprovider.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,12 @@ QgsOgrProvider::QgsOgrProvider( QString const &uri )
469469
bool supportsBoolean = false;
470470

471471
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,3,0)
472-
const char *pszDataTypes = GDALGetMetadataItem( mOgrOrigLayer->driver(), GDAL_DMD_CREATIONFIELDDATASUBTYPES, nullptr );
473-
if ( pszDataTypes && strstr( pszDataTypes, "Boolean" ) )
474-
supportsBoolean = true;
472+
if ( mOgrOrigLayer )
473+
{
474+
const char *pszDataTypes = GDALGetMetadataItem( mOgrOrigLayer->driver(), GDAL_DMD_CREATIONFIELDDATASUBTYPES, nullptr );
475+
if ( pszDataTypes && strstr( pszDataTypes, "Boolean" ) )
476+
supportsBoolean = true;
477+
}
475478
#else
476479
if ( mGDALDriverName == QLatin1String( "GeoJSON" ) ||
477480
mGDALDriverName == QLatin1String( "GML" ) ||

0 commit comments

Comments
 (0)
Please sign in to comment.