[Misc] Check if object is null everywhere XWikiDocument#getXObjects() is used in xwiki-platform-wiki.

Check if object is null everywhere XWikiDocument#getXObjects() is used in xwiki-platform-wiki.