Update AppModel, ComputerModel, and StreamUtil asserts to cover negative indices

This commit is contained in:
Cameron Gutman committed 2026-11-15 00:33:01 -06:00
1 parent 2d600c4e6b
commit 4e8fc3aead
3 files changed
+13 -13

No files matched your search

+2 -2
View File
@@ -266,7 +266,7 @@ bool StreamUtils::getNativeDesktopMode(int displayIndex, SDL_DisplayMode* mode,
CGDirectDisplayID displayIds[MAX_DISPLAYS];
uint32_t displayCount = 0;
CGGetActiveDisplayList(MAX_DISPLAYS, displayIds, &displayCount);
if (displayIndex >= (int)displayCount) {
if (displayIndex < 0 || displayIndex >= (int)displayCount) {
return false;
}
@@ -343,7 +343,7 @@ bool StreamUtils::getNativeDesktopMode(int displayIndex, SDL_DisplayMode* mode,
#else
SDL_assert(SDL_WasInit(SDL_INIT_VIDEO));
if (displayIndex >= SDL_GetNumVideoDisplays()) {
if (displayIndex < 0 || displayIndex >= SDL_GetNumVideoDisplays()) {
return false;
}