Fix division by zero.

This commit is contained in:
Christian Speckner 2024-06-30 11:00:46 +02:00
parent 905f5eee90
commit 4248f5b916
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -