From 2b154fd86ef9e37e23e905379fe0f4bc62cc8d84 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 27 Aug 2023 19:39:23 +0200 Subject: [PATCH] [MIRROR] Fixes an issue with the "recolor from string" option in the greyscale modify menu [MDB IGNORE] (#23365) * Fixes an issue with the "recolor from string" option in the greyscale modify menu (#77798) ## About The Pull Request The number of colors has to match the expected color of the greyscale configuration, otherwise the whole proc chain behind the generation of the resulting icon will crash here: https://github.com/tgstation/tgstation/blob/ac446d8bad3596016217112a53fe91b8140dace2/code/datums/greyscale/_greyscale_config.dm#L253 ## Why It's Good For The Game One of the thousands runtimes I've seen in the runtime viewer. ## Changelog :cl: fix: Fixed an issue with the "recolor from string" option in the greyscale modify menu that resulted in invisible icons. /:cl: * Fixes an issue with the "recolor from string" option in the greyscale modify menu --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> --- code/modules/admin/greyscale_modify_menu.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/admin/greyscale_modify_menu.dm b/code/modules/admin/greyscale_modify_menu.dm index a6f525b48fa..fd2db6d1ed3 100644 --- a/code/modules/admin/greyscale_modify_menu.dm +++ b/code/modules/admin/greyscale_modify_menu.dm @@ -243,7 +243,7 @@ This is highly likely to cause massive amounts of lag as every object in the gam /datum/greyscale_modify_menu/proc/ReadColorsFromString(colorString) var/list/new_split_colors = list() var/list/colors = splittext(colorString, "#") - for(var/index in 2 to length(colors)) + for(var/index in 2 to min(length(colors), config.expected_colors + 1)) var/color = "#[colors[index]]" if(!findtext(color, GLOB.is_color) && (!unlocked || !findtext(color, GLOB.is_alpha_color))) return FALSE