Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
mod->num_surfaces = 0;
mod->surfmesh.num_vertices = 0;
mod->surfmesh.num_triangles = 0;
- memset(mod->surfmesh.data_vertexhash, -1, mod->surfmesh.num_vertexhashsize * sizeof(*mod->surfmesh.data_vertexhash));
+ if (mod->surfmesh.data_vertexhash) // UBSan: memset arg 1 isn't allowed to be null, but sometimes this is NULL.
+ memset(mod->surfmesh.data_vertexhash, -1, mod->surfmesh.num_vertexhashsize * sizeof(*mod->surfmesh.data_vertexhash));
mod->DrawSky = NULL; // will be set if a texture needs it
mod->DrawAddWaterPlanes = NULL; // will be set if a texture needs it
}