From 4e483dad4b065c79db031dc28d8f3854a518b24d Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Tue, 23 Jan 2024 17:39:55 +0100 Subject: [PATCH] Fix: String Offset Assert in Color Picker Dragging on a color value slider in the color picker will assert for an invalid string offset. We now using std::string for uiBut->str, the string is empty and we are checking against str[1]. This replaces that with an std::basic_string::find which handles this fine. Pull Request: https://projects.blender.org/blender/blender/pulls/117455 --- .../blender/editors/interface/interface_region_color_picker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_region_color_picker.cc b/source/blender/editors/interface/interface_region_color_picker.cc index e1e72d4a0e3..732f86c2f2f 100644 --- a/source/blender/editors/interface/interface_region_color_picker.cc +++ b/source/blender/editors/interface/interface_region_color_picker.cc @@ -216,7 +216,7 @@ static void ui_update_color_picker_buts_rgb(uiBut *from_but, const int col_len = SNPRINTF_RLEN(col, "%02X%02X%02X", UNPACK3_EX((uint), rgb_hex_uchar, )); memcpy(bt->poin, col, col_len + 1); } - else if (bt->str[1] == ' ') { + else if (bt->str.find(' ', 1) == 1) { if (bt->str[0] == 'R') { ui_but_value_set(bt, rgb_scene_linear[0]); }