From cb67458020931c56f25281a1fa1a9204e5137794 Mon Sep 17 00:00:00 2001 From: sdottaka Date: Mon, 21 Oct 2024 22:57:58 +0900 Subject: [PATCH] Add Support for Custom System Color Overrides (#2376) (2) --- Src/Common/SysColorHook.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Src/Common/SysColorHook.cpp b/Src/Common/SysColorHook.cpp index 8ea8ca477ce..9d836e56487 100644 --- a/Src/Common/SysColorHook.cpp +++ b/Src/Common/SysColorHook.cpp @@ -1,5 +1,5 @@ /** - * @file SysColorHook.h + * @file SysColorHook.cpp * * @brief Provides functionality to hook the GetSysColor() API and return custom colors. */ @@ -138,7 +138,10 @@ void Deserialize(const String& colorsStr, COLORREF* colors) unsigned color = static_cast(tc::tcstoll(colorStr.c_str(), &endptr, (colorStr.length() >= 2 && colorStr[1] == 'x') ? 16 : 10)); if (colors) - colors[index] = color; + { + if (index >= 0 && index < static_cast(std::size(g_syscolor))) + colors[index] = color; + } else SysColorHook::SetSysColor(index, color); }