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); }