johnBuffer/AntSimulator

Crash in grid.hpp - vector subscript is out of range

StevenJAckerman opened this issue · 1 comments

Running latest release, conf.txt file attached, using release map.png

conf.txt

AntSimulator Crash call stack

Cells vector subscript is out of range in this function:

const T& getCst(sf::Vector2i cell_coord) const
{
	return cells[getIndexFromCoords(cell_coord)];
}

cell_coord.x = 207, cell_coord.y = 270, cells.size = 129600

In the called function, width = 480:

uint64_t getIndexFromCoords(const sf::Vector2i& cell_coords) const
{
	return cell_coords.x + cell_coords.y * width;
}

So this returns 207 + (270 * 480) = 129807 which is out of range.

Thanks, I did push a fix, it should be fine now