Skip to content

Commit

Permalink
[bugfix] Prevent a bad crash when provider is wrong
Browse files Browse the repository at this point in the history
Fixes #17155
  • Loading branch information
elpaso committed Nov 7, 2017
1 parent bb36fa7 commit 2523d73
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -1530,12 +1530,8 @@ bool QgsVectorLayer::setDataProvider( QString const &provider )
dataSource = uri.uri( false );
}

// XXX when execution gets here.

//XXX - This was a dynamic cast but that kills the Windows
// version big-time with an abnormal termination error
delete mDataProvider;
mDataProvider = ( QgsVectorDataProvider * )( QgsProviderRegistry::instance()->createProvider( provider, dataSource ) );
mDataProvider = qobject_cast<QgsVectorDataProvider *>( QgsProviderRegistry::instance()->createProvider( provider, dataSource ) );
if ( !mDataProvider )
{
QgsDebugMsg( " unable to get data provider" );
Expand Down

0 comments on commit 2523d73

Please sign in to comment.