diff --git a/kbinxml/src/text_reader.rs b/kbinxml/src/text_reader.rs index f158f3d..a2d6970 100644 --- a/kbinxml/src/text_reader.rs +++ b/kbinxml/src/text_reader.rs @@ -298,6 +298,9 @@ impl<'a> TextXmlReader<'a> { if let Some((ref mut parent_collection, _count, _size)) = self.stack.last_mut() { parent_collection.children_mut().push_back(collection); + } else { + // The end of the structure has been reached. + return Ok(Some(collection)); } }, Event::Decl(e) => {