From 256e77c987d2d8a3c1fc672eb75b3efe32441789 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 19 Nov 2020 10:33:08 +0100 Subject: [PATCH] Fix T82833: GreasePencil crash when changing to Vertex Color mode This is actually a user interface issue, introduced on 0688309988e5. 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. --- source/blender/editors/interface/interface_query.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index d0075ba8617..83e48fad157 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -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);