From 4248f5b916ed681b1ddb818e048dc3805dd996b3 Mon Sep 17 00:00:00 2001 From: Christian Speckner Date: Sun, 30 Jun 2024 11:00:46 +0200 Subject: [PATCH] Fix division by zero. --- src/emucore/Console.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 3a0590959..0d9a68a86 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -1277,9 +1277,13 @@ void Console::changeAutoFireRate(int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - float Console::currentFrameRate() const { + uInt32 scalinesLastFrame = myTIA->frameBufferScanlinesLastFrame(); + return - (myConsoleTiming == ConsoleTiming::ntsc ? 262.F * 60.F : 312.F * 50.F) / - myTIA->frameBufferScanlinesLastFrame(); + scalinesLastFrame != 0 ? + (myConsoleTiming == ConsoleTiming::ntsc ? 262.F * 60.F : 312.F * 50.F) + / myTIA->frameBufferScanlinesLastFrame() : + 0; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -