1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-26 02:03:48 +00:00

fix possible crash in GridRender

probably introduced in 22c8471bf2
This commit is contained in:
fgenesis 2024-02-06 01:34:20 +01:00
parent 5a24f2868b
commit cd46cc24fa

View file

@ -95,7 +95,8 @@ void GridRender::rebuildBuffers(const std::vector<ObsRow>& rows)
{ {
const size_t H = game->getGridSize().y; const size_t H = game->getGridSize().y;
primIndexInLine.resize(H); primIndexInLine.resize(H);
if(H)
{
size_t lasty = 0; size_t lasty = 0;
size_t lastidx = 0; size_t lastidx = 0;
for(size_t i = 0; i < N; ++i) for(size_t i = 0; i < N; ++i)
@ -115,6 +116,7 @@ void GridRender::rebuildBuffers(const std::vector<ObsRow>& rows)
// Don't bother filling the rest, anything beyond the end is eval'd as primsToDraw // Don't bother filling the rest, anything beyond the end is eval'd as primsToDraw
primIndexInLine.resize(lasty); primIndexInLine.resize(lasty);
} }
}
// 2 tris = 6 verts per ObsRow, each vertex is 2x uint16, makes 24b per quad. // 2 tris = 6 verts per ObsRow, each vertex is 2x uint16, makes 24b per quad.
// We could use indexed rendering and use 2 verts less (16b), // We could use indexed rendering and use 2 verts less (16b),