Fix error when filtering in Outliner "Blender File" mode with libraries

Steps to reproduce were:
* Load factory settings
* Link any library
* Change to "Blender File" display mode in Outliner
* Enable filtering
* -> Assert fails

This may have had further side-effects for linked IDs.
Checked with Bastien, the NULL-check seems reasonable. It was initially there
but removed in d74f9c4b7b.

Fine to backport.
This commit is contained in:
Julian Eisel 2020-06-26 12:23:17 +02:00 committed by Jeroen Bakker
parent e34a751172
commit d0c986b748
1 changed files with 4 additions and 2 deletions

View File

@ -2332,8 +2332,10 @@ void outliner_build_tree(
for (lib = mainvar->libraries.first; lib; lib = lib->id.next) {
ten = outliner_add_library_contents(mainvar, soops, &soops->tree, lib);
BLI_assert(ten != NULL);
lib->id.newid = (ID *)ten;
/* NULL-check matters, due to filtering there may not be a new element. */
if (ten) {
lib->id.newid = (ID *)ten;
}
}
/* make hierarchy */
ten = soops->tree.first;