Fix T82833: GreasePencil crash when changing to Vertex Color mode

This is actually a user interface issue, introduced on 0688309988.

but->tip is checked for NULL in other parts, and rightly so, since here
it crashes Blender.

On a side note I don't know how to reliably reproduce the original bug
whose fix introduced this issue. That got on the way of seeing whether
this is the correct fix, if it happens outside greasepencil operators.

Maybe it is an operator that is missing a tooltip? Impossible to tell
without more information from said commit. That said since this happened
during the end of bcon3 and we are not in bcon4 I'm going ahead with
this NULL check commit.

Patch reviewed by Philipp Oeser and Sergey Sharybin.
This commit is contained in:
Dalai Felinto 2020-11-19 10:33:08 +01:00
parent ad58999b0d
commit 256e77c987
Notes: blender-bot 2023-02-14 04:20:36 +01:00
Referenced by issue #84889, EnumProperty with ENUM_FLAG causes a crash
Referenced by issue #82854, Bevel modifier custom profile handle type crash
Referenced by issue #82836, Blender Grease Pencil edit mode crash
Referenced by issue #82833, GreasePencil: Crash when changing to Vertex Color mode in Draw mode
1 changed files with 4 additions and 0 deletions

View File

@ -463,6 +463,10 @@ size_t ui_but_drawstr_len_without_sep_char(const uiBut *but)
size_t ui_but_tip_len_only_first_line(const uiBut *but)
{
if (but->tip == NULL) {
return 0;
}
const char *str_sep = strchr(but->tip, '\n');
if (str_sep != NULL) {
return (str_sep - but->tip);