From 3a07d767fb080f87c86f79e67a0db9624078bbb1 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 20 Feb 2022 20:28:19 +0100 Subject: [PATCH] Fix rare crash on division by 0 --- Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp b/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp index 5628a2471..169036aa9 100644 --- a/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp +++ b/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp @@ -423,7 +423,7 @@ void ShadowsOfMordor::Builder::onJobRender(GPUContext* context) #endif // Report progress - float hemispheresProgress = static_cast(_workerStagePosition1) / lightmapEntry.Hemispheres.Count(); + float hemispheresProgress = static_cast(_workerStagePosition1) / Math::Max(lightmapEntry.Hemispheres.Count(), 1); float lightmapsProgress = static_cast(_workerStagePosition0 + hemispheresProgress) / scene->Lightmaps.Count(); float bouncesProgress = static_cast(_giBounceRunningIndex) / _bounceCount; reportProgress(BuildProgressStep::RenderHemispheres, lightmapsProgress / _bounceCount + bouncesProgress);