Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-11-03 16:21:56 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-11-22 18:28:58 +0300
commit89adf516cd17c6345ef74efc0c52e53edae3d519 (patch)
tree693dee4aa27a69158221261d4dbbbdc46817d42a
parent4796865b466fc93965623581f100941831d85d79 (diff)
Fix T92760: Crash erasing GPencil when occlusion test is enabled
`pt0` was read when `NULL` and `is_occluded_pt1` could be read even if it is not initialized.
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index cdf546e18b9..ee9c7924f2d 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1594,10 +1594,12 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p,
*/
if (gpencil_stroke_inside_circle(mval, radius, pc0[0], pc0[1], pc2[0], pc2[1])) {
- bool is_occluded_pt0, is_occluded_pt1, is_occluded_pt2 = true;
- is_occluded_pt0 = (pt0 && ((pt0->flag & GP_SPOINT_TEMP_TAG) != 0)) ?
- ((pt0->flag & GP_SPOINT_TEMP_TAG2) != 0) :
- gpencil_stroke_eraser_is_occluded(p, gpl, pt0, pc0[0], pc0[1]);
+ bool is_occluded_pt0 = true, is_occluded_pt1 = true, is_occluded_pt2 = true;
+ if (pt0) {
+ is_occluded_pt0 = ((pt0->flag & GP_SPOINT_TEMP_TAG) != 0) ?
+ ((pt0->flag & GP_SPOINT_TEMP_TAG2) != 0) :
+ gpencil_stroke_eraser_is_occluded(p, gpl, pt0, pc0[0], pc0[1]);
+ }
if (is_occluded_pt0) {
is_occluded_pt1 = ((pt1->flag & GP_SPOINT_TEMP_TAG) != 0) ?
((pt1->flag & GP_SPOINT_TEMP_TAG2) != 0) :