diff options
4 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c index 1f106ff90a7..846b3779649 100644 --- a/source/blender/blenkernel/intern/freestyle.c +++ b/source/blender/blenkernel/intern/freestyle.c @@ -107,7 +107,8 @@ void BKE_freestyle_config_copy(FreestyleConfig *new_config, FreestyleConfig *con static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *lineset) { new_lineset->linestyle = lineset->linestyle; - new_lineset->linestyle->id.us++; + if (lineset->linestyle) + new_lineset->linestyle->id.us++; new_lineset->flags = lineset->flags; new_lineset->selection = lineset->selection; new_lineset->qi = lineset->qi; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 5d0216affca..8c2475369de 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -643,7 +643,9 @@ void BKE_object_unlink(Object *ob) for (lineset = (FreestyleLineSet *)srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) { - BKE_unlink_linestyle_target_object(lineset->linestyle, ob); + if (lineset->linestyle) { + BKE_unlink_linestyle_target_object(lineset->linestyle, ob); + } } } } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 041a2c2216e..09b6e7d2206 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1546,7 +1546,9 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data for (srl = sce->r.layers.first; srl; srl = srl->next) { for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) { - lineset->linestyle->id.flag |= LIB_DOIT; + if (lineset->linestyle) { + lineset->linestyle->id.flag |= LIB_DOIT; + } } } @@ -1562,8 +1564,11 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data ListBase tmp_data = {NULL, NULL}; size_t tmp_items = 0; - if (!(linestyle->id.flag & LIB_DOIT)) + if ((linestyle == NULL) || + !(linestyle->id.flag & LIB_DOIT)) + { continue; + } linestyle->id.flag &= ~LIB_DOIT; /* add scene-level animation channels */ diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 8cb44d05b84..7dc218c74df 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -369,7 +369,7 @@ static void prepare(Main *bmain, Render *re, SceneRenderLayer *srl) if (lineset->flags & FREESTYLE_LINESET_ENABLED) { if (G.debug & G_DEBUG_FREESTYLE) { cout << " " << layer_count+1 << ": " << lineset->name << " - " << - lineset->linestyle->id.name + 2 << endl; + (lineset->linestyle ? (lineset->linestyle->id.name + 2) : "<NULL>") << endl; } Text *text = create_lineset_handler(bmain, srl->name, lineset->name); controller->InsertStyleModule(layer_count, lineset->name, text); @@ -680,9 +680,11 @@ void FRS_paste_active_lineset(FreestyleConfig *config) FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); if (lineset) { - lineset->linestyle->id.us--; + if (lineset->linestyle) + lineset->linestyle->id.us--; lineset->linestyle = lineset_buffer.linestyle; - lineset->linestyle->id.us++; + if (lineset->linestyle) + lineset->linestyle->id.us++; lineset->flags = lineset_buffer.flags; lineset->selection = lineset_buffer.selection; lineset->qi = lineset_buffer.qi; @@ -711,10 +713,10 @@ void FRS_delete_active_lineset(FreestyleConfig *config) if (lineset) { if (lineset->group) { lineset->group->id.us--; - lineset->group = NULL; } - lineset->linestyle->id.us--; - lineset->linestyle = NULL; + if (lineset->linestyle) { + lineset->linestyle->id.us--; + } BLI_remlink(&config->linesets, lineset); MEM_freeN(lineset); BKE_freestyle_lineset_set_active_index(config, 0); |