Linux: Fixed crash on startup when show game timer option is enabled

This commit is contained in:
Sour 2019-08-04 22:27:09 -04:00
parent 982d0e0010
commit 7e854b4376
2 changed files with 3 additions and 2 deletions

View file

@ -147,7 +147,8 @@ void BaseRenderer::ShowFpsCounter(int lineNumber)
void BaseRenderer::ShowGameTimer(int lineNumber)
{
int yPos = 13 + 24 * lineNumber;
double frameCount = _console->GetPpu()->GetFrameCount();
shared_ptr<Ppu> ppu = _console->GetPpu();
double frameCount = ppu ? ppu->GetFrameCount() : 0;
bool isPal = _console->GetRegion() == ConsoleRegion::Pal;
double frameRate = isPal ? 50.006977968268290848936010226333 : 60.098811862348404716732985230828;
uint32_t seconds = (uint32_t)(frameCount / frameRate) % 60;

View file

@ -182,7 +182,7 @@ void SdlRenderer::Render()
SDL_Rect dest = {0, 0, (int)_screenWidth, (int)_screenHeight };
SDL_RenderCopy(_sdlRenderer, _sdlTexture, &source, &dest);
if(_console->GetVideoDecoder()->IsRunning()) {
if(_console->IsRunning()) {
if(paused) {
DrawPauseScreen();
}