Fix T57590: assert with zero length array buttons.

This commit is contained in:
2019-03-18 19:56:14 +01:00
parent 10d1edbffb
commit b0752cd7a0

View File

@@ -61,9 +61,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
{
int arraylen = RNA_property_array_length(ptr, prop);
if (arraylen && index == -1)
if (RNA_property_array_check(prop) && index == -1)
return NULL;
if (icon && name && name[0] == '\0')
@@ -77,9 +75,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
case PROP_INT:
case PROP_FLOAT:
{
int arraylen = RNA_property_array_length(ptr, prop);
if (arraylen && index == -1) {
if (RNA_property_array_check(prop) && index == -1) {
if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA)) {
but = uiDefButR_prop(block, UI_BTYPE_COLOR, 0, name, x1, y1, x2, y2, ptr, prop, -1, 0, 0, -1, -1, NULL);
}