From 52fcee9c91817fc187cbc2d489f9439bb2bce581 Mon Sep 17 00:00:00 2001 From: wraitii Date: Sat, 27 Feb 2021 10:21:04 +0000 Subject: [PATCH] Fix division by 0 error in PickSpawnPoint The spawn code should not assume that obstructions will never be 0-sized. Reported by: Zack Fixes #6039 Differential Revision: https://code.wildfiregames.com/D3583 This was SVN commit r24945. --- source/simulation2/components/CCmpFootprint.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/simulation2/components/CCmpFootprint.cpp b/source/simulation2/components/CCmpFootprint.cpp index 1911428f15..e40c5bd38a 100644 --- a/source/simulation2/components/CCmpFootprint.cpp +++ b/source/simulation2/components/CCmpFootprint.cpp @@ -170,6 +170,9 @@ public: if (cmpSpawnedObstruction) { spawnedRadius = cmpSpawnedObstruction->GetSize(); + // Force a positive radius to avoid division by zero errors. + if (spawnedRadius == 0) + spawnedRadius = 1; spawnedTag = cmpSpawnedObstruction->GetObstruction(); }