[Bf-blender-cvs] [1c1b78eab58] master: Make libquery resilient to old blend-files missing pointers.
Bastien Montagne
noreply at git.blender.org
Fri Feb 14 12:52:52 CET 2020
Commit: 1c1b78eab584e9c4ccdd60568af94d6ec5ef999c
Author: Bastien Montagne
Date: Fri Feb 14 12:50:52 2020 +0100
Branches: master
https://developer.blender.org/rB1c1b78eab584e9c4ccdd60568af94d6ec5ef999c
Make libquery resilient to old blend-files missing pointers.
This makes libquery usable during blendfile reading phases.
Some pointers that shall never be NULL in modern Main database did not
exist before.
===================================================================
M source/blender/blenkernel/intern/lib_query.c
===================================================================
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index fcbb1458749..4b4d744c41a 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -528,7 +528,10 @@ static void library_foreach_ID_link(Main *bmain,
SEQ_END;
}
- library_foreach_collection(&data, scene->master_collection);
+ /* This pointer can be NULL during old files reading, better be safe than sorry. */
+ if (scene->master_collection != NULL) {
+ library_foreach_collection(&data, scene->master_collection);
+ }
ViewLayer *view_layer;
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
@@ -1030,13 +1033,15 @@ static void library_foreach_ID_link(Main *bmain,
wmWindowManager *wm = (wmWindowManager *)id;
for (wmWindow *win = wm->windows.first; win; win = win->next) {
- ID *workspace = (ID *)BKE_workspace_active_get(win->workspace_hook);
-
CALLBACK_INVOKE(win->scene, IDWALK_CB_USER_ONE);
- CALLBACK_INVOKE_ID(workspace, IDWALK_CB_NOP);
- /* allow callback to set a different workspace */
- BKE_workspace_active_set(win->workspace_hook, (WorkSpace *)workspace);
+ /* This pointer can be NULL during old files reading, better be safe than sorry. */
+ if (win->workspace_hook != NULL) {
+ ID *workspace = (ID *)BKE_workspace_active_get(win->workspace_hook);
+ CALLBACK_INVOKE_ID(workspace, IDWALK_CB_NOP);
+ /* allow callback to set a different workspace */
+ BKE_workspace_active_set(win->workspace_hook, (WorkSpace *)workspace);
+ }
}
break;
}
More information about the Bf-blender-cvs
mailing list