1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

Fix crash on startup

This commit is contained in:
fgenesis 2021-01-11 19:26:32 +01:00
parent 6af1fd10e1
commit 812848e382

View file

@ -2538,12 +2538,18 @@ void SceneEditor::prevElement()
void SceneEditor::doPrevElement()
{
int oldCur = curElement;
curElement--;
if (curElement >= game->elementTemplates.size())
curElement = dsq->game->elementTemplates.size()-1;
size_t oldCur = curElement;
size_t maxn = dsq->game->elementTemplates.size();
if (dsq->game->elementTemplates[curElement].idx < 1024)
if(curElement)
curElement--;
else if(maxn)
curElement = maxn-1;
if (maxn && curElement >= maxn)
curElement = maxn-1;
if (maxn && dsq->game->elementTemplates[curElement].idx < 1024)
{
placer->setTexture(dsq->game->elementTemplates[curElement].gfx);
}