]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_brush.c
avoid NULL pointer access if a surface had an unsupported type
[xonotic/darkplaces.git] / model_brush.c
index d16d67ebce94f32725f0bf2a1693b9051270f82a..627764fca743965b6f4e52d94c57a004e74b7d92 100644 (file)
@@ -5320,12 +5320,12 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l)
                        continue;
                if(out->num_vertices == 0)
                {
-                       Con_Printf("Mod_Q3BSP_LoadFaces: surface %d (texture %s) has no vertices, ignoring\n", i, out->texture->name);
+                       Con_Printf("Mod_Q3BSP_LoadFaces: surface %d (texture %s) has no vertices, ignoring\n", i, out->texture ? out->texture->name : "(none)");
                        if(out->num_triangles == 0)
-                               Con_Printf("Mod_Q3BSP_LoadFaces: surface %d (texture %s) has no triangles, ignoring\n", i, out->texture->name);
+                               Con_Printf("Mod_Q3BSP_LoadFaces: surface %d (texture %s) has no triangles, ignoring\n", i, out->texture ? out->texture->name : "(none)");
                }
                else if(out->num_triangles == 0)
-                       Con_Printf("Mod_Q3BSP_LoadFaces: surface %d (texture %s, near %f %f %f) has no triangles, ignoring\n", i, out->texture->name,
+                       Con_Printf("Mod_Q3BSP_LoadFaces: surface %d (texture %s, near %f %f %f) has no triangles, ignoring\n", i, out->texture ? out->texture->name : "(none)",
                                        (loadmodel->surfmesh.data_vertex3f + 3 * out->num_firstvertex)[0 * 3 + 0],
                                        (loadmodel->surfmesh.data_vertex3f + 3 * out->num_firstvertex)[1 * 3 + 0],
                                        (loadmodel->surfmesh.data_vertex3f + 3 * out->num_firstvertex)[2 * 3 + 0]);