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:
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/blender/editors/render/render_shading.c
parente28bd0d3024f6a21adbc1aa74fa87865ae613046 (diff)
Follow-up to r60433 (related to Bug #36878): additional checks for NULL line styles.
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r--source/blender/editors/render/render_shading.c36
1 files changed, 34 insertions, 2 deletions
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: