mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 18:24:05 +02:00
improved error handling
This commit is contained in:
parent
ff18680a02
commit
e005f35f73
2 changed files with 4 additions and 2 deletions
|
|
@ -179,14 +179,14 @@ fn parse_string_table_list(
|
|||
stream: &mut Stream,
|
||||
table_meta: &StringTableMeta,
|
||||
entry_count: u16,
|
||||
) -> ReadResult<Vec<StringTableEntry>> {
|
||||
) -> Result<Vec<StringTableEntry>> {
|
||||
let mut entries = Vec::with_capacity(entry_count as usize);
|
||||
|
||||
let mut history: Vec<Option<String>> = Vec::new();
|
||||
|
||||
for _ in 0..entry_count {
|
||||
if !stream.read::<bool>()? {
|
||||
panic!("there should be no holes when reading CreateStringTable message");
|
||||
return Err(ParseError::InvalidDemo("there should be no holes when reading CreateStringTable message".to_string()));
|
||||
};
|
||||
|
||||
let entry = read_table_entry(stream, table_meta, &history)?;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ pub enum ParseError {
|
|||
/// Actual decompressed size
|
||||
size: u32,
|
||||
},
|
||||
/// Misc malformed demo error
|
||||
InvalidDemo(String)
|
||||
}
|
||||
|
||||
impl From<ReadError> for ParseError {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue