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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user