Skip to content
Permalink
Browse files

Fix a few crashes with bad layers

  • Loading branch information
elpaso committed Nov 6, 2018
1 parent 1e16680 commit 2dd3f969f8fc8467bdc06a3970eaa0ef90c655e0
Showing with 5 additions and 2 deletions.
  1. +3 −0 src/app/gps/qgsgpsinformationwidget.cpp
  2. +1 −1 src/app/qgisapp.cpp
  3. +1 −1 src/app/qgslayertreeviewmemoryindicator.cpp
@@ -1140,6 +1140,9 @@ void QgsGpsInformationWidget::updateCloseFeatureButton( QgsMapLayer *lyr )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( lyr );

if ( !( vlayer && vlayer->isValid() ) )
return;

// Add feature button tracks edit state of layer
if ( vlayer != mpLastLayer )
{
@@ -11298,7 +11298,7 @@ bool QgisApp::checkUnsavedLayerEdits()
{
// note that we skip the unsaved edits check for memory layers -- it's misleading, because their contents aren't actually
// saved if this is part of a project close operation. Instead we let these get picked up by checkMemoryLayers()
if ( vl->dataProvider()->name() == QLatin1String( "memory" ) )
if ( ! vl->dataProvider() || vl->dataProvider()->name() == QLatin1String( "memory" ) )
continue;

const bool hasUnsavedEdits = ( vl->isEditable() && vl->isModified() );
@@ -43,7 +43,7 @@ void QgsLayerTreeViewMemoryIndicatorProvider::onIndicatorClicked( const QModelIn
bool QgsLayerTreeViewMemoryIndicatorProvider::acceptLayer( QgsMapLayer *layer )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
if ( !vlayer )
if ( !( vlayer && vlayer->isValid() ) )
return false;
return vlayer->dataProvider()->name() == QLatin1String( "memory" );
}

0 comments on commit 2dd3f96

Please sign in to comment.
You can’t perform that action at this time.