Page MenuHome

Fix potential issues when loading files with missing libraries

Authored by Sebastian Parborg (zeddb) on Aug 6 2019, 5:15 PM.



This is a continuation of rB39f005eae8eed8b939579aff8c9a05a4f50e5e38

Now all the fields where we check for object type in RNA (like rna_Curve_object_poll) will have a safe guard for when this isn't the case.
For example when loading files that has missing object libraries and all missing objects are replaced with empties (placeholders).

Diff Detail

rB Blender

Event Timeline

Besides notes below, patch LGTM... Which is kind of expected since I suggested those changes to @Sebastian Parborg (zeddb) ;)

So this diff is mostly to get @Brecht Van Lommel (brecht)'s point of view on that change.

Note that the other solution here (to generate placeholder objects of the expected type) is simply impossible, as we do not store object's type info for the linked ID in our .blend file....


Think that code should not reset the pointer, otherwise we loose the connection and relocating the broken lib to its valid path won't be able to recreate that link.
Same below too.


Better use explicit pointer == NULL than implicit boolean check for NULL pointers... At least that's in our code practices iirc?

There's probably more issues like this throughout the code. This patch is fine with me though, not sure how else this would be handled better.


In most other places we only do a implicit check. Is this something I should change in the other files also?


We try to apply this rule to new code, old one can be cleaned up on a lazy basis (i.e. when you need to change it anyway for another reason)…

Sebastian Parborg (zeddb) marked 3 inline comments as done.Aug 14 2019, 12:21 PM
Sebastian Parborg (zeddb) updated this revision to Diff 17098.

I've updated the patch based on the feedback.

This revision is now accepted and ready to land.Fri, Aug 23, 12:59 PM