Skip to content

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎src/gui/qgsmapcanvas.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,11 @@ QgsMapRender* QgsMapCanvas::mapRender()
175175

176176
QgsMapLayer* QgsMapCanvas::getZpos(int index)
177177
{
178-
QString layer = mMapRender->layerSet()[index];
179-
return QgsMapLayerRegistry::instance()->mapLayer(layer);
178+
std::deque<QString>& layers = mMapRender->layerSet();
179+
if (index >= 0 && index < (int) layers.size())
180+
return QgsMapLayerRegistry::instance()->mapLayer(layers[index]);
181+
else
182+
return NULL;
180183
}
181184

182185

0 commit comments

Comments
 (0)
Please sign in to comment.