mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 13:23:56 -07:00
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.
This commit is contained in:
parent
c6f50b253f
commit
52fcee9c91
1 changed files with 3 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue