diff options
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_fill.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_fill.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 069493025dc..45a2247c65e 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1387,6 +1387,15 @@ static void gpencil_get_outline_points(tGPDfill *tgpf, const bool dilate) current_check_co[1] = boundary_co[1] + offset[offset_idx][1]; int image_idx = ibuf->x * current_check_co[1] + current_check_co[0]; + /* Check if the index is inside the image. If the index is outside is + * because the algorithm is unable to find the outline of the figure. This is + * possible for negative filling when click inside a figure instead of + * clicking outside. + * If the index is out of range, finish the filling. */ + if (image_idx > imagesize - 1) { + start_found = false; + break; + } get_pixel(ibuf, image_idx, rgba); /* find next boundary pixel */ |