KYRA: avoid possible nullptr deref

This commit is contained in:
athrxx 2023-06-06 20:31:22 +02:00
parent 20ee021407
commit e8d21cf93a

View File

@ -208,11 +208,12 @@ void Screen_EoB::setClearScreenDim(int dim) {
void Screen_EoB::clearCurDim() {
static const uint8 amigaColorMap[16] = { 0x00, 0x06, 0x1d, 0x1b, 0x1a, 0x17, 0x18, 0x0e, 0x19, 0x1c, 0x1c, 0x1e, 0x13, 0x0a, 0x11, 0x1f };
fillRect(_curDim->sx << 3, _curDim->sy, ((_curDim->sx + _curDim->w) << 3) - 1, (_curDim->sy + _curDim->h) - 1, _isAmiga ? amigaColorMap[_curDim->col2] : _use16ColorMode ? 0 : _curDim->col2);
if (_curDim)
fillRect(_curDim->sx << 3, _curDim->sy, ((_curDim->sx + _curDim->w) << 3) - 1, (_curDim->sy + _curDim->h) - 1, _isAmiga ? amigaColorMap[_curDim->col2] : _use16ColorMode ? 0 : _curDim->col2);
}
void Screen_EoB::clearCurDimOvl(int pageNum) {
if (pageNum > 1 || !_useOverlays)
if (pageNum > 1 || !_useOverlays || !_curDim)
return;
addDirtyRect(_curDim->sx << 3, _curDim->sy, _curDim->w << 3, _curDim->h);
clearOverlayRect(pageNum, _curDim->sx << 3, _curDim->sy, _curDim->w << 3, _curDim->h);