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
This commit is contained in:
Harley Acheson
2024-01-23 17:39:55 +01:00
committed by Harley Acheson
parent d8b085089c
commit 4e483dad4b

View File

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