mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix #122150: UI: layout.template_search() crash without an active item
`template_search` was introduced in c20c203b82
Seems it assumed an active item is always there.
Without an active item, we are running into a crash trying to get the
textbut width.
So solution is to not draw that text button at all until an active item
is chosen.
This also goes in line with what `template_ID` is doing (it also skips
the text button without an active item).
Pull Request: https://projects.blender.org/blender/blender/pulls/122165
This commit is contained in:
parent
246c57cbe2
commit
59f21ebce0
1 changed files with 5 additions and 0 deletions
|
|
@ -2084,6 +2084,11 @@ static void template_search_add_button_name(uiBlock *block,
|
|||
PointerRNA *active_ptr,
|
||||
const StructRNA *type)
|
||||
{
|
||||
/* Skip text button without an active item. */
|
||||
if (active_ptr->data == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
PropertyRNA *name_prop = RNA_struct_name_property(type);
|
||||
const int width = template_search_textbut_width(active_ptr, name_prop);
|
||||
const int height = template_search_textbut_height();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue