From 6701ad8cc5b5c25122b3cc65947eb35a2fca5b0d Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sat, 30 Dec 2023 16:31:47 +0200 Subject: [PATCH] collision: add additional checks --- src/common/collision.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/common/collision.c b/src/common/collision.c index 285a0df1..efbac7a4 100644 --- a/src/common/collision.c +++ b/src/common/collision.c @@ -2231,6 +2231,11 @@ CM_LeafContents(int leafnum) int CM_LeafCluster(int leafnum) { + if (!cmod->map_leafs) + { + return 0; + } + if ((leafnum < 0) || (leafnum >= (cmod->numleafs + EXTRA_LUMP_LEAFS))) { Com_Error(ERR_DROP, "%s: bad number", __func__); @@ -2242,6 +2247,11 @@ CM_LeafCluster(int leafnum) int CM_LeafArea(int leafnum) { + if (!cmod->map_leafs) + { + return 0; + } + if ((leafnum < 0) || (leafnum >= (cmod->numleafs + EXTRA_LUMP_LEAFS))) { Com_Error(ERR_DROP, "%s: bad number", __func__); @@ -2333,7 +2343,7 @@ CM_ClusterPVS(int cluster) byte * CM_ClusterPHS(int cluster) { - if (cluster == -1) + if (cluster == -1 || !cmod->map_vis) { memset(phsrow, 0, (cmod->numclusters + 7) >> 3); }