When a xobject is deleted, it's null in the new version of the document, but the code seems to assume there is always a xobject in the new version.