1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

fix six possible "divide by zero"

This commit is contained in:
Hubert Jarosz
2016-03-01 00:08:33 +01:00
committed by Hubert Jarosz
parent bf7f9244a9
commit 7b07bcaf44
6 changed files with 23 additions and 15 deletions

View File

@@ -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()
{
}