[Scummvm-git-logs] scummvm master -> ac0c696a522298e1585fd7b9ea0aab1daa4eac23

bluegr noreply at scummvm.org
Thu Jul 18 09:51:28 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ac0c696a52 DGDS: Add a sanity check in drawBackgroundNoSliders()


Commit: ac0c696a522298e1585fd7b9ea0aab1daa4eac23
    https://github.com/scummvm/scummvm/commit/ac0c696a522298e1585fd7b9ea0aab1daa4eac23
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2024-07-18T12:51:20+03:00

Commit Message:
DGDS: Add a sanity check in drawBackgroundNoSliders()

Opening the menu while in class attempts to draw an empty menu

Changed paths:
    engines/dgds/request.cpp


diff --git a/engines/dgds/request.cpp b/engines/dgds/request.cpp
index b6f9ccf110c..3625ceb0754 100644
--- a/engines/dgds/request.cpp
+++ b/engines/dgds/request.cpp
@@ -760,14 +760,19 @@ void RequestData::drawBackgroundWithSliderArea(Graphics::ManagedSurface *dst, in
 void RequestData::drawBackgroundNoSliders(Graphics::ManagedSurface *dst, const Common::String &header) const {
 	DgdsEngine *engine = static_cast<DgdsEngine *>(g_engine);
 	DgdsGameId gameId = engine->getGameId();
+
+	if (_rect.width == 0 || _rect.height == 0) {
+		warning("drawBackgroundNoSliders: empty rect");
+		return;
+	}
+
 	if (gameId != GID_WILLY)
 		fillBackground(dst, _rect.x, _rect.y, _rect.width, _rect.height, 0);
 	else
 		fillBackground(dst, _rect.x + 5, _rect.y + 5, _rect.width - 10, _rect.height - 10, 0);
 	uint16 cornerOffset = (gameId == GID_DRAGON ? 11 : (gameId == GID_HOC ? 1 : 0));
 	drawCorners(dst, cornerOffset, _rect.x, _rect.y, _rect.width, _rect.height);
-	drawHeader(dst, _rect.x, _rect.y, _rect.width, 4, header, 0,
-		engine->getGameId() == GID_DRAGON);
+	drawHeader(dst, _rect.x, _rect.y, _rect.width, 4, header, 0, gameId == GID_DRAGON);
 }
 
 /*static*/




More information about the Scummvm-git-logs mailing list