Throw an exception with more information instead of an NPE This seems to be a corrupted document and shows up in regression tests and should at least be reported with some more information