diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-27 15:05:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-27 15:05:08 +0400 |
commit | 9a2d862123913ad015eac287d245efed5072ff48 (patch) | |
tree | 6b7e904438231b037317879163125a14fe2be5b8 /source/blender/blenkernel/intern/mask.c | |
parent | 915fdd67dfff68c70b617c174e21d074335dee36 (diff) |
clamp mask resolution, the occasional crash would happen failing to alloc when adding feather points very close together.
Diffstat (limited to 'source/blender/blenkernel/intern/mask.c')
-rw-r--r-- | source/blender/blenkernel/intern/mask.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 3c008692cbb..df38cc9571f 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -301,6 +301,12 @@ int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height) resol = MAX2(resol, cur_resol); } + BLI_assert(resol > 0); + + if (resol > MASK_RESOL_MAX) { + resol = MASK_RESOL_MAX; + } + return resol; } @@ -331,6 +337,12 @@ int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height resol += max_jump / max_segment; + BLI_assert(resol > 0); + + if (resol > MASK_RESOL_MAX) { + resol = MASK_RESOL_MAX; + } + return resol; } |