Fix T49022: Crash in BKE_libblock_remap_locked.

Previous check to skip non-linkable IDs resulted in not clearing those skipped ID's newid member,
wich lead to try to remap it later in code.
This commit is contained in:
Bastien Montagne 2016-08-05 17:09:56 +02:00
parent b7bf9ed2b4
commit 50c017b6ea
Notes: blender-bot 2023-02-14 07:42:09 +01:00
Referenced by issue #49022, Crash in BKE_libblock_remap_locked
1 changed files with 4 additions and 6 deletions

View File

@ -1641,11 +1641,9 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged
for (a = set_listbasepointers(bmain, lbarray); a--; ) {
id = lbarray[a]->first;
if (!id || !BKE_idcode_is_linkable(GS(id->name))) {
/* Do not explicitly make local non-linkable IDs (shapekeys, in fact), they are assumed to be handled
* by real datablocks responsible of them. */
continue;
}
/* Do not explicitly make local non-linkable IDs (shapekeys, in fact), they are assumed to be handled
* by real datablocks responsible of them. */
const bool do_skip = (id && BKE_idcode_is_linkable(GS(id->name)));
for (; id; id = id_next) {
id->newid = NULL;
@ -1656,7 +1654,7 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged
* appending data, so any libdata already linked wont become local
* (very nasty to discover all your links are lost after appending)
* */
if (id->tag & (LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW) &&
if (!do_skip && id->tag & (LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW) &&
((untagged_only == false) || !(id->tag & LIB_TAG_PRE_EXISTING)))
{
if (lib == NULL || id->lib == lib) {