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

This commit is contained in:
Antonio Vazquez 2020-03-26 12:33:52 +01:00
parent 671b6d41c4
commit 90e8f94558
Notes: blender-bot 2023-02-14 06:00:46 +01:00
Referenced by issue #75094, Grease Pencil: Selection mode crash in Vertex Paint when build modifier is used
1 changed files with 3 additions and 3 deletions

View File

@ -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 */