diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-13 05:53:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-13 05:53:07 +0400 |
commit | 1c1e7a0237ebace73b573f435cf51863be7a43fd (patch) | |
tree | f59e92b1f3d947ce506c8c1170b5a19aaba4b770 /intern | |
parent | 2243ab514a8038df74fd2be0b20a4227b93c11a6 (diff) |
avoid divide by zero in cycles progress calculation
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/render/session.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index ad43c39469c..b8ed942f5b6 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -518,8 +518,8 @@ void BlenderSession::get_progress(float& progress, double& total_time) sample = session->progress.get_sample(); samples_per_tile = session->params.samples; - if(samples_per_tile) - progress = ((float)sample/(float)(tile_total * samples_per_tile)); + if(samples_per_tile && tile_total) + progress = ((float)sample / (float)(tile_total * samples_per_tile)); else progress = 0.0; } diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 41212c2db84..003b722b5a5 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -757,7 +757,7 @@ void Session::update_status_time(bool show_pause, bool show_done) if(preview_time == 0.0 && resolution == 1) preview_time = time_dt(); - double tile_time = (tile == 0)? 0.0: (time_dt() - preview_time - paused_time)/(sample); + double tile_time = (tile == 0 || sample == 0)? 0.0: (time_dt() - preview_time - paused_time) / sample; /* negative can happen when we pause a bit before rendering, can discard that */ if(preview_time < 0.0) preview_time = 0.0; |