Prevent crash when moving a layer to the top of a list that only has two entries (closes #3414)

This commit is contained in:
Alexander Bock
2025-02-06 13:02:02 +01:00
parent 44a1cd2e7a
commit b8e5fab5f5

View File

@@ -221,7 +221,7 @@ void LayerGroup::moveLayer(int oldPosition, int newPosition) {
ghoul_assert(!_layers.empty(), "The list should not be empty at this point");
if (newLayerPos == _layers.begin()) {
// If the layer is moved to the first spot in the list
Layer* nextLayer = (_layers.begin() + 1)->get();
Layer* nextLayer = _layers.begin()->get();
layer->setZIndex(nextLayer->zIndex());
}
else if (newLayerPos == _layers.end()) {