Fix crash if the last layer index saved in the doc preferences is out of bounds

This commit is contained in:
David Capello 2016-08-19 18:51:15 -03:00
parent 36719da7b2
commit eb43fa93bd

View File

@ -193,7 +193,7 @@ Editor::Editor(Document* document, EditorFlags flags)
LayerList layers = m_sprite->allBrowsableLayers(); LayerList layers = m_sprite->allBrowsableLayers();
layer_t layerIndex = m_docPref.site.layer(); layer_t layerIndex = m_docPref.site.layer();
if (layerIndex >= 0 && layerIndex <= int(layers.size())) if (layerIndex >= 0 && layerIndex < int(layers.size()))
setLayer(layers[layerIndex]); setLayer(layers[layerIndex]);
} }