Skip to content
Snippets Groups Projects
Commit 00600fc4 authored by Matthew Hall's avatar Matthew Hall
Browse files

Make sure parser will end if the document ends

parent aa390a07
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,7 @@ macro_rules! parse_tag {
break;
}
}
EndDocument => return Err(PrematureEnd("Document ended before we expected.".to_string())),
_ => {}
}
}
......@@ -77,6 +78,7 @@ pub enum TiledError {
/// [flate2](https://github.com/alexcrichton/flate2-rs) crate.
DecompressingError(IoError),
DecodingError(FromBase64Error),
PrematureEnd(String),
Other(String)
}
......@@ -455,6 +457,7 @@ pub fn parse<B: Buffer>(parser: &mut EventReader<B>) -> Result<Map, TiledError>
return Map::new(parser, attributes);
}
}
EndDocument => return Err(PrematureEnd("Document ended before map was parsed".to_string())),
_ => {}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment