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
path: root/source
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-10-01 03:02:29 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-10-01 03:02:29 +0400
commitaaba317c763657d7c309a1c3e96b58f5924afd29 (patch)
tree4faf1cabbfab4f63e4ffe00d42a9bcd3dace83b1 /source
parente28bd0d3024f6a21adbc1aa74fa87865ae613046 (diff)
Follow-up to r60433 (related to Bug #36878): additional checks for NULL line styles.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/freestyle.c2
-rw-r--r--source/blender/editors/render/render_shading.c36
-rw-r--r--source/blender/makesrna/intern/rna_scene.c3
3 files changed, 37 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c
index 846b3779649..d87c93310c8 100644
--- a/source/blender/blenkernel/intern/freestyle.c
+++ b/source/blender/blenkernel/intern/freestyle.c
@@ -107,7 +107,7 @@ void BKE_freestyle_config_copy(FreestyleConfig *new_config, FreestyleConfig *con
static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *lineset)
{
new_lineset->linestyle = lineset->linestyle;
- if (lineset->linestyle)
+ if (new_lineset->linestyle)
new_lineset->linestyle->id.us++;
new_lineset->flags = lineset->flags;
new_lineset->selection = lineset->selection;
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 58c244228ed..c19c5a38517 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -860,8 +860,12 @@ static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active lineset to add a new line style to");
return OPERATOR_CANCELLED;
}
- lineset->linestyle->id.us--;
- lineset->linestyle = BKE_copy_linestyle(lineset->linestyle);
+ if (lineset->linestyle) {
+ lineset->linestyle->id.us--;
+ lineset->linestyle = BKE_copy_linestyle(lineset->linestyle);
+ } else {
+ lineset->linestyle = BKE_new_linestyle("LineStyle", NULL);
+ }
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
@@ -894,6 +898,10 @@ static int freestyle_color_modifier_add_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
if (BKE_add_linestyle_color_modifier(lineset->linestyle, type) == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unknown line color modifier type");
return OPERATOR_CANCELLED;
@@ -933,6 +941,10 @@ static int freestyle_alpha_modifier_add_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
if (BKE_add_linestyle_alpha_modifier(lineset->linestyle, type) == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unknown alpha transparency modifier type");
return OPERATOR_CANCELLED;
@@ -972,6 +984,10 @@ static int freestyle_thickness_modifier_add_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
if (BKE_add_linestyle_thickness_modifier(lineset->linestyle, type) == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unknown line thickness modifier type");
return OPERATOR_CANCELLED;
@@ -1011,6 +1027,10 @@ static int freestyle_geometry_modifier_add_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
if (BKE_add_linestyle_geometry_modifier(lineset->linestyle, type) == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unknown stroke geometry modifier type");
return OPERATOR_CANCELLED;
@@ -1064,6 +1084,10 @@ static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
switch (freestyle_get_modifier_type(&ptr)) {
case LS_MODIFIER_TYPE_COLOR:
@@ -1114,6 +1138,10 @@ static int freestyle_modifier_copy_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
switch (freestyle_get_modifier_type(&ptr)) {
case LS_MODIFIER_TYPE_COLOR:
@@ -1165,6 +1193,10 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
switch (freestyle_get_modifier_type(&ptr)) {
case LS_MODIFIER_TYPE_COLOR:
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index f1a05700bd9..0cfb399c470 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1541,7 +1541,8 @@ static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value
{
FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
- lineset->linestyle->id.us--;
+ if (lineset->linestyle)
+ lineset->linestyle->id.us--;
lineset->linestyle = (FreestyleLineStyle *)value.data;
lineset->linestyle->id.us++;
}