diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index e63b822e2..4cd486f87 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1434,7 +1434,6 @@ void I_SetPalette(RGBA_t *palette) } } - // make sure the canonical resolutions are always available static const struct { const int w, h; @@ -1563,13 +1562,18 @@ static void I_FillScreenResolutionsList(boolean force) // did not find mode from list, make custom resolution if the values somewhat make sense if (needcustom) { - snprintf(desired_resolution, sizeof(desired_resolution), "%dx%d", custom_w, custom_h); + if (list_size < MAXWINMODES) + { + snprintf(desired_resolution, sizeof(desired_resolution), "%dx%d", custom_w, custom_h); - // [FG] if the desired resolution not in the list, append it - windowedModes[list_size].name = strdup(desired_resolution); - windowedModes[list_size].w = custom_w; - windowedModes[list_size].h = custom_h; - list_size++; + // [FG] if the desired resolution not in the list, append it + windowedModes[list_size].name = strdup(desired_resolution); + windowedModes[list_size].w = custom_w; + windowedModes[list_size].h = custom_h; + list_size++; + } + else + CONS_Alert(CONS_ERROR, "Could not set custom resolution!\n"); } }