fix potential fatal errors

This commit is contained in:
MihailRis 2026-10-12 00:30:49 +03:00
parent 6f466d52f2
commit f246619c6b
3 changed files with 10 additions and 2 deletions

View file

@ -133,6 +133,9 @@ static model::Mesh load_mesh(
if (flags == FLAG_ZLIB) {
throw std::runtime_error("compression is not supported yet");
}
if (attributeCount <= 0) {
throw std::runtime_error("mesh must have at least one attribute");
}
std::vector<VertexAttribute> attributes;
for (int i = 0; i < attributeCount; i++) {
attributes.push_back(load_attribute(reader));