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 onc31f74de6b
. 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.
This commit is contained in:
parent
bb0e8f1c55
commit
f11bcbed9d
Notes:
blender-bot
2023-02-14 08:42:54 +01:00
Referenced by issue #51934, Integer overflow when displaying long custom property arrays in the outliner Referenced by issue #51913, Context tab for textures issue
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue