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

ccawley2011 ccawley2011 at gmail.com
Mon Apr 5 19:31:29 UTC 2021


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:
cf511755b0 SDL: Improve graphics mode checks


Commit: cf511755b087895766866db49ecebac5baa0f566
    https://github.com/scummvm/scummvm/commit/cf511755b087895766866db49ecebac5baa0f566
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-04-05T20:31:05+01:00

Commit Message:
SDL: Improve graphics mode checks

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index cba0b77535..b4efb180f6 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -625,7 +625,7 @@ void SurfaceSdlGraphicsManager::detectSupportedFormats() {
 #endif
 
 int SurfaceSdlGraphicsManager::getGraphicsModeScale(int mode) const {
-	if (mode >= (int)s_supportedGraphicsModes->size())
+	if (mode < 0 || mode >= (int)s_supportedGraphicsModes->size())
 		return -1;
 
 	return (*s_supportedGraphicsModesData)[mode].scaleFactor;
@@ -641,7 +641,7 @@ bool SurfaceSdlGraphicsManager::setGraphicsMode(int mode, uint flags) {
 
 	int newScaleFactor;
 
-	if (mode >= (int)s_supportedGraphicsModes->size()) {
+	if (mode < 0 || mode >= (int)s_supportedGraphicsModes->size()) {
 		warning("unknown gfx mode %d", mode);
 		return false;
 	}




More information about the Scummvm-git-logs mailing list