]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.c
sys: [Linux] remove/replace obsolete timing and sleep syscalls, slightly improve...
[xonotic/darkplaces.git] / model_shared.c
index 866ee56ee5a2c2332f2fe213aad1753e6b95ec80..d6cea915396455ffce1b181e5ed6a0f99018af31 100644 (file)
@@ -550,7 +550,7 @@ model_t *Mod_LoadModel(model_t *mod, qbool crash, qbool checkdisk)
                        Con_Printf(CON_ERROR "Mod_LoadModel: model \"%s\" is of unknown/unsupported type\n", mod->name);
        }
        else if (crash)
-               // LadyHavoc: Sys_Abort was *ANNOYING*
+               // LadyHavoc: Sys_Error was *ANNOYING*
                Con_Printf (CON_ERROR "Mod_LoadModel: %s not found\n", mod->name);
 
        // no fatal errors occurred, so this model is ready to use.
@@ -4467,7 +4467,8 @@ void Mod_Mesh_Reset(model_t *mod)
        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
 }