From 07a9d9aa0fd1000910e82d86f7e470c05ffb7b9a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 19 Jul 2013 15:37:25 +0200 Subject: [PATCH] Fix a divide-by-zero crash in the 3ds Max plugins on really fast PCs --- code/nel/tools/3d/object_viewer/object_viewer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index 19490309b..bc9949079 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -1271,7 +1271,8 @@ void CObjectViewer::go () // Calc FPS static sint64 lastTime=NLMISC::CTime::getPerformanceTime (); sint64 newTime=NLMISC::CTime::getPerformanceTime (); - float fps = (float)(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime)); + sint64 timeDiff = newTime - lastTime; + float fps = timeDiff > 0 ? (float)(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime)) : 1000.0f; lastTime=newTime; char msgBar[1024]; uint nbPlayingSources, nbSources;