Skip to content

Commit

Permalink
pie_AssignTexture: Sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Jul 6, 2024
1 parent ea7fbf1 commit b2730fb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ivis_opengl/tex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ size_t pie_ReserveTexture(const char *filename, const size_t& width, const size_

void pie_AssignTexture(size_t page, gfx_api::texture* texture)
{
if (page >= _TEX_PAGE.size())
{
debug(LOG_ERROR, "Invalid page (%zu), number of texpages=%zu", page, _TEX_PAGE.size());
delete texture;
return;
}
if (_TEX_PAGE[page].id)
delete _TEX_PAGE[page].id;
_TEX_PAGE[page].id = texture;
Expand Down

0 comments on commit b2730fb

Please sign in to comment.