Skip to content

Commit

Permalink
Check that vertexarray vec not empty before getting reference to elem…
Browse files Browse the repository at this point in the history
…ent.
  • Loading branch information
logzero committed Jan 19, 2024
1 parent 2e53589 commit c85725b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/graphics/vertexarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ void SetData(std::vector<T> & vec, const T array[], unsigned count, unsigned off
if (size != vec.size())
vec.resize(size);

if (vec.empty()) return; // sanity check

auto myarray = &(vec[offset]);
std::memcpy(myarray, array, sizeof(T) * count);
}
Expand Down

0 comments on commit c85725b

Please sign in to comment.