Correct crash in last commit (spacebar search)

This commit is contained in:
Campbell Barton 2015-04-21 15:18:16 +10:00
parent 56a93e9cb1
commit f36e91ad0a
1 changed files with 14 additions and 3 deletions

View File

@ -1967,18 +1967,29 @@ static bool ui_but_icon_extra_is_visible_search_unlink(const uiBut *but)
static bool ui_but_icon_extra_is_visible_eyedropper(uiBut *but)
{
StructRNA *type = RNA_property_pointer_type(&but->rnapoin, but->rnaprop);
const short idcode = RNA_type_to_ID_code(type);
StructRNA *type;
short idcode;
BLI_assert(but->type == UI_BTYPE_SEARCH_MENU && (but->flag & UI_BUT_SEARCH_UNLINK));
if (but->rnaprop == NULL) {
return false;
}
type = RNA_property_pointer_type(&but->rnapoin, but->rnaprop);
idcode = RNA_type_to_ID_code(type);
return ((but->editstr == NULL) &&
(idcode == ID_OB || OB_DATA_SUPPORT_ID(idcode)));
}
uiButExtraIconType ui_but_icon_extra_get(uiBut *but)
{
if (ui_but_icon_extra_is_visible_search_unlink(but)) {
if ((but->flag & UI_BUT_SEARCH_UNLINK) == 0) {
/* pass */
}
else if (ui_but_icon_extra_is_visible_search_unlink(but)) {
return UI_BUT_ICONEXTRA_UNLINK;
}
else if (ui_but_icon_extra_is_visible_eyedropper(but)) {