From 4fcdba446e461a8e239b6179687cfb1dcff8526e Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 3 Oct 2004 17:25:24 +0000 Subject: Fixed bug #1039162 (Sam & Max intro crash) by making drawBox() do nothing if the box's width or height is zero or less. svn-id: r15394 --- scumm/gfx.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 2bd74043ca..d8f3b8f9cc 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -868,12 +868,19 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) { else if (y2 > vs->h) y2 = vs->h; + width = x2 - x; + height = y2 - y; + + // This will happen in the Sam & Max intro - see bug #1039162 - where + // it would trigger an assertion in blit(). + + if (width <= 0 || height <= 0) + return; + markRectAsDirty(vs->number, x, x2, y, y2); backbuff = vs->getPixels(x, y); - width = x2 - x; - height = y2 - y; if (color == -1) { if (vs->number != kMainVirtScreen) error("can only copy bg to main window"); -- cgit v1.2.3