diff options
author | Hubert Jarosz <marqin.pl+git@gmail.com> | 2016-03-01 00:08:33 +0100 |
---|---|---|
committer | Hubert Jarosz <marqin.pl@gmail.com> | 2016-03-09 00:18:23 +0100 |
commit | 7b07bcaf449ea6cf52c2ac501e48cddbe4bde035 (patch) | |
tree | 5d5c2abcc801262b72f02f5e9c7c70a20c729e73 /servers | |
parent | bf7f9244a95962c9833e68743726fe83a00b732c (diff) |
fix six possible "divide by zero"
Diffstat (limited to 'servers')
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index c9695b7859..2ce0c9a360 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -5667,7 +5667,10 @@ void VisualServerRaster::_instance_validate_autorooms(Instance *p_geometry) { int pass = room->room_info->room->bounds.get_points_inside(dst_points,point_count); - float ratio = (float)pass / point_count; + float ratio = pass; + if( point_count != 0 ) { + ratio /= (float)point_count; + } if (ratio>0.5) // should make some constant p_geometry->valid_auto_rooms.insert(room); @@ -7670,5 +7673,3 @@ VisualServerRaster::VisualServerRaster(Rasterizer *p_rasterizer) { VisualServerRaster::~VisualServerRaster() { } - - |