Skip to content

Commit 15f1485

Browse files
committed
addVectorLayers: return early if no layers were succesfully added
fixes an abort later on if all the layer loadings failed for some reason, like missing the shx file for a shapefile.
1 parent 93f7d9a commit 15f1485

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/app/qgisapp.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -2286,12 +2286,16 @@ bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QS
22862286

22872287
// since the layer is bad, stomp on it
22882288
delete layer;
2289-
2290-
// XXX should we return false here, or just grind through
2291-
// XXX the remaining arguments?
22922289
}
22932290

22942291
}
2292+
2293+
// make sure at least one layer was succesfully added
2294+
if ( myList.count() == 0 )
2295+
{
2296+
return false;
2297+
}
2298+
22952299
// Register this layer with the layers registry
22962300
QgsMapLayerRegistry::instance()->addMapLayers( myList );
22972301

0 commit comments

Comments
 (0)