Crash occurs due to accessing the pointer which points to garbage
memory. In brief, `base_next` points to next base element (`base->next`) which is
deleted in previous iteration. After `BKE_library_ID_is_indirectly_used`
call, viewlayer is synced and frees the `object_bases` list. It results
`base_next` pointing to garbage memory.
To fix this, point to `base->next` after `BKE_library_ID_is_indirectly_used` function call,