diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/screen.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 09f87f3f8b..6a70bfb5d9 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -206,6 +206,10 @@ void DirtyAreas::copy(MSurface *srcSurface, MSurface *destSurface, const Common: for (uint i = 0; i < size(); ++i) { const Common::Rect &srcBounds = (*this)[i]._bounds; + // Check if this is a sane rectangle before attempting to create it + if (srcBounds.left >= srcBounds.right || srcBounds.top >= srcBounds.bottom) + continue; + Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); @@ -219,6 +223,10 @@ void DirtyAreas::copyToScreen(const Common::Point &posAdjust) { for (uint i = 0; i < size(); ++i) { const Common::Rect &srcBounds = (*this)[i]._bounds; + // Check if this is a sane rectangle before attempting to create it + if (srcBounds.left >= srcBounds.right || srcBounds.top >= srcBounds.bottom) + continue; + Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); |