mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-28 23:06:24 +02:00
Fixed undefined behavior on accessing array with -1 index
This commit is contained in:
parent
5d16f035d7
commit
d5f8db2222
@ -648,7 +648,14 @@ void CSpellWindow::SpellArea::setSpell(const CSpell * spell)
|
||||
|
||||
{
|
||||
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
|
||||
schoolBorder = std::make_shared<CAnimImage>(owner->schoolBorders[owner->selectedTab >= 4 ? whichSchool.getNum() : owner->selectedTab], schoolLevel);
|
||||
schoolBorder.reset();
|
||||
if (owner->selectedTab >= 4)
|
||||
{
|
||||
if (whichSchool.getNum() != SpellSchool())
|
||||
schoolBorder = std::make_shared<CAnimImage>(owner->schoolBorders.at(whichSchool.getNum()), schoolLevel);
|
||||
}
|
||||
else
|
||||
schoolBorder = std::make_shared<CAnimImage>(owner->schoolBorders.at(owner->selectedTab), schoolLevel);
|
||||
}
|
||||
|
||||
ColorRGBA firstLineColor, secondLineColor;
|
||||
|
Loading…
Reference in New Issue
Block a user