From 02389b39c87d21fa5b38dbe7cf0cb5a83118c4b6 Mon Sep 17 00:00:00 2001 From: jonas Date: Tue, 26 Mar 2019 11:07:48 +0100 Subject: cRender: Added divide by zero check --- src/cRender.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/cRender.cpp') diff --git a/src/cRender.cpp b/src/cRender.cpp index 148be91..ddc52df 100644 --- a/src/cRender.cpp +++ b/src/cRender.cpp @@ -445,7 +445,10 @@ void cRender::printDebugInfo() { char dbgtxt[30]; - sprintf(dbgtxt, "R: %f F: %f", ((float)lastRenderTime) / CLOCKS_PER_SEC, 1/getFrametime()); + double lrt = (double)lastFrameTime / CLOCKS_PER_SEC; + double fps = getFrametime()? 1/getFrametime():0; + + sprintf(dbgtxt, "R: %f F: %f", lrt, fps); drawText(dbgtxt, {0,0}, _COL_BLACK | _COL_WHITE_BG); } -- cgit v1.2.3