From f11bcbed9d0402db271bc610eaec156583e746fa Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 27 Jun 2017 16:53:43 +0200 Subject: Fix T51913: Context tab for textures issue The original code was doing a sanity check to see if existing index was out of range. However the comparison was wrong. So if the previous ct->user (active index of texture node) was larger than then number of available texture nodes + 1 in the other material, we would never re-set the index to 0. Bug introduced on c31f74de6bb7. There was an early attempt of fixing this (2b2ac5d3cc) but it was just working by pure, luck. And failing in cases like the one from this bug report. --- source/blender/editors/space_buttons/buttons_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 72de7e5c81c..1d67ac620b0 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -470,7 +470,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) } else { /* set one user as active based on active index */ - if (ct->index == BLI_listbase_count_ex(&ct->users, ct->index + 1)) + if (ct->index >= BLI_listbase_count_ex(&ct->users, ct->index + 1)) ct->index = 0; ct->user = BLI_findlink(&ct->users, ct->index); -- cgit v1.2.3