Browse Source

crash fix on water region hitting a node number beyond range

Image 3 years ago
parent
commit
f06c312ddc
1 changed files with 8 additions and 0 deletions
  1. 8 0
      EQ2/source/WorldServer/Zone/region_map_v1.cpp

+ 8 - 0
EQ2/source/WorldServer/Zone/region_map_v1.cpp

@@ -625,6 +625,14 @@ WaterRegionType RegionMapV1::BSPReturnRegionTypeNode(const Region_Node* region_n
 
 
 WaterRegionType RegionMapV1::BSPReturnRegionWaterRegion(const Region_Node* region_node, const ZBSP_Node* BSP_Root, int32 node_number, const glm::vec3& location, float distToNode) const {
+	if(node_number > region_node->vert_count)
+	{
+		LogWrite(REGION__DEBUG, 0, "Region", "Region %s grid %u (%s) - Node %u is out of range for region max vert count of %i.  Hit at location %f %f %f.", 
+		region_node->regionName.c_str(), region_node->grid_id, region_node->regionScriptName.c_str(), node_number, region_node->vert_count,
+		location.x, location.y, location.z);
+		return (RegionTypeNormal);
+	}
+
 	const ZBSP_Node* current_node = &BSP_Root[node_number - 1];
 	float distance;