[Bf-blender-cvs] [90e8f94558e] master: Fix T75094: Gpencil Selection mode crash in Vertex Paint when build modifier is used

Antonio Vazquez noreply at git.blender.org
Thu Mar 26 12:34:32 CET 2020


Commit: 90e8f94558ed8f233f536c37c3bc98e0f969b517
Author: Antonio Vazquez
Date:   Thu Mar 26 12:33:52 2020 +0100
Branches: master
https://developer.blender.org/rB90e8f94558ed8f233f536c37c3bc98e0f969b517

Fix T75094: Gpencil Selection mode crash in Vertex Paint when build modifier is used

===================================================================

M	source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c

===================================================================

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
index 3263b78ba85..435559f4881 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
@@ -116,7 +116,7 @@ static void reduce_stroke_points(bGPDstroke *gps,
 {
   bGPDspoint *new_points = MEM_callocN(sizeof(bGPDspoint) * num_points, __func__);
   MDeformVert *new_dvert = NULL;
-  if (gps->dvert != NULL) {
+  if ((gps->dvert != NULL) && (num_points > 0)) {
     new_dvert = MEM_callocN(sizeof(MDeformVert) * num_points, __func__);
   }
 
@@ -130,7 +130,7 @@ static void reduce_stroke_points(bGPDstroke *gps,
     {
       /* copy over point data */
       memcpy(new_points, gps->points, sizeof(bGPDspoint) * num_points);
-      if (gps->dvert != NULL) {
+      if ((gps->dvert != NULL) && (num_points > 0)) {
         memcpy(new_dvert, gps->dvert, sizeof(MDeformVert) * num_points);
 
         /* free unused point weights */
@@ -151,7 +151,7 @@ static void reduce_stroke_points(bGPDstroke *gps,
 
       /* copy over point data */
       memcpy(new_points, gps->points + offset, sizeof(bGPDspoint) * num_points);
-      if (gps->dvert != NULL) {
+      if ((gps->dvert != NULL) && (num_points > 0)) {
         memcpy(new_dvert, gps->dvert + offset, sizeof(MDeformVert) * num_points);
 
         /* free unused weights */



More information about the Bf-blender-cvs mailing list