[Bf-blender-cvs] [ebdb549] master: GPencil: Avoid segment fault if new stroke function is called without colorname

Antonioya noreply at git.blender.org
Wed Aug 10 15:53:33 CEST 2016


Commit: ebdb5490b3a63e37ac5638f8a06737cf34ba36d3
Author: Antonioya
Date:   Wed Aug 10 15:51:40 2016 +0200
Branches: master
https://developer.blender.org/rBebdb5490b3a63e37ac5638f8a06737cf34ba36d3

GPencil: Avoid segment fault if new stroke function is called without colorname

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

M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 7424c19..9476c96 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -482,7 +482,9 @@ static void rna_GPencil_stroke_point_pop(bGPDstroke *stroke, ReportList *reports
 static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame, const char *colorname)
 {
 	bGPDstroke *stroke = MEM_callocN(sizeof(bGPDstroke), "gp_stroke");
-	strcpy(stroke->colorname, colorname);
+	if (colorname) {
+		strcpy(stroke->colorname, colorname);
+	}
 	stroke->palcolor = NULL;
 	stroke->flag |= GP_STROKE_RECALC_COLOR;
 	BLI_addtail(&frame->strokes, stroke);




More information about the Bf-blender-cvs mailing list