diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-08-29 10:56:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-08-29 10:56:19 +0400 |
commit | 1d9e69f1463f01ab2242b05cb6a0486a6f9eaeaf (patch) | |
tree | f9ca95c68436ac36ceda4f9ece0b345366d5bfc2 /source/blender/blenkernel/intern/texture.c | |
parent | 55cacb2e63e342705e25e205c1b805956a7226bd (diff) |
Fix T41617: Color ramp crashes user preferences
Color ramps with no handles caused issues.
Diffstat (limited to 'source/blender/blenkernel/intern/texture.c')
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 4d5c7dc1bf7..b1981a3a804 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -512,19 +512,18 @@ CBData *colorband_element_add(struct ColorBand *coba, float position) if (coba->tot == MAXCOLORBAND) { return NULL; } - else if (coba->tot > 0) { + else { CBData *xnew; - float col[4]; - - do_colorband(coba, position, col); xnew = &coba->data[coba->tot]; xnew->pos = position; - xnew->r = col[0]; - xnew->g = col[1]; - xnew->b = col[2]; - xnew->a = col[3]; + if (coba->tot != 0) { + do_colorband(coba, position, &xnew->r); + } + else { + zero_v4(&xnew->r); + } } coba->tot++; |