Added NULL pointer check to avoid crashes when initializing zapper with no ROM loaded.

This commit is contained in:
mjbudd77 2021-05-23 18:48:25 -04:00
parent c2c76de841
commit 5c4f402a1f
2 changed files with 2 additions and 2 deletions

View File

@ -1171,7 +1171,7 @@ void GetMouseData (uint32 (&d)[3])
b |= 0x02;
}
}
else
else if ( consoleWindow->viewport_GL )
{
consoleWindow->viewport_GL->getNormalizedCursorPos(nx,ny);

View File

@ -215,7 +215,7 @@ static INPUTC ZAPVSC={ReadZapperVS,0,StrobeZapperVS,UpdateZapper,ZapperFrapper,D
INPUTC *FCEU_InitZapper(int w)
{
memset(&ZD[w],0,sizeof(ZAPPER));
if(GameInfo->type == GIT_VSUNI)
if ( (GameInfo != NULL) && (GameInfo->type == GIT_VSUNI) )
return(&ZAPVSC);
else
return(&ZAPC);