Fix crash with XML parsing for invalid objects