Skip to content
Permalink
Browse files
[bugfix] Prevent a bad crash when provider is wrong
Fixes #17155
  • Loading branch information
elpaso committed Nov 7, 2017
1 parent bb36fa7 commit 2523d7351cf166b15941edd707586951a30ed54b
Showing 1 changed file with 1 addition and 5 deletions.
@@ -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" );

0 comments on commit 2523d73

Please sign in to comment.