[Scummvm-git-logs] scummvm master -> 0622b3c341cd278492dafd0a4d1300637cd4c90e

fracturehill noreply at scummvm.org
Sat Oct 21 17:36:28 UTC 2023


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:
0622b3c341 SLUDGE: Fix crash when drawing text


Commit: 0622b3c341cd278492dafd0a4d1300637cd4c90e
    https://github.com/scummvm/scummvm/commit/0622b3c341cd278492dafd0a4d1300637cd4c90e
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-10-21T20:36:01+03:00

Commit Message:
SLUDGE: Fix crash when drawing text

The space character in Out of Order has a height of 0,
which caused a divide by zero error further down the chain
in the blitting code.  Instead of attempting to draw,
fontSprite() now simply skips them.

Changed paths:
    engines/sludge/sprites.cpp


diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index 4c1a2d6c030..3e0579af7cd 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -297,6 +297,11 @@ void GraphicsManager::burnSpriteToBackDrop(int x1, int y1, Sprite &single, const
 }
 
 void GraphicsManager::fontSprite(bool flip, int x, int y, Sprite &single, const SpritePalette &fontPal) {
+	if (!single.surface.w || !single.surface.h) {
+		// Skip surfaces with a 0 width/height (e.g. the space character on Out of Order) to avoid crashes in the blitting code.
+		return;
+	}
+
 	float x1 = (float)x - (float)single.xhot / _cameraZoom;
 	float y1 = (float)y - (float)single.yhot / _cameraZoom;
 




More information about the Scummvm-git-logs mailing list