From 5d9c01c53fd58c9f5b9b9ac32995bae865448b7b Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 9 Sep 2019 11:11:16 +0200 Subject: [PATCH] Fix T69663: 2.81 Cant open/append/link a blend file but 2.8 can Was a problem in the versioning code from rBbaaa89a0bc54, since the TexMapping struct could already be freed and node->storage could already be set to NULL (if a file with the new mapping node [saved from (2, 81, 8) or newer] is opened in a blender version prior to (2, 81, 8) and saved from there again). Reviewers: brecht Maniphest Tasks: T69663 Differential Revision: https://developer.blender.org/D5723 --- source/blender/blenloader/intern/versioning_cycles.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index 1abf099b4c2..d4d940daba5 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -797,7 +797,10 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree) bool need_update = false; for (bNode *node = ntree->nodes.first; node; node = node->next) { - if (node->type == SH_NODE_MAPPING) { + /* If node->storage is NULL, then conversion has already taken place. + * This can happen if a file with the new mapping node [saved from (2, 81, 8) or newer] + * is opened in a blender version prior to (2, 81, 8) and saved from there again. */ + if (node->type == SH_NODE_MAPPING && node->storage) { TexMapping *mapping = (TexMapping *)node->storage; node->custom1 = mapping->type; node->width = 140.0f;