commit f8774ae6ed1618b4b64d2a24e40a2cc33bcece83
parent 18ba03463e02ed86ed00b371947997c9a58dcb6f
Author: William Casarin <jb55@jb55.com>
Date: Fri, 8 May 2020 19:49:29 -0700
fix some crashes near world edge
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/terrain_collision.c b/src/terrain_collision.c
@@ -176,6 +176,8 @@ struct tri *collide_terrain(struct terrain *terrain, float *pos, float *move, fl
get_closest_verts(terrain, pos, queries, cells);
for (int j = 0; j < ARRAY_SIZE(queries); j++) {
+ if (!queries[j].cell)
+ continue;
int vind = queries[j].cell->verts_index[queries[j].cell_vert_index];
struct vert_tris *vtris = &terrain->vtris[vind / 3];