1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-04 11:04:07 +02:00

dont panic when parsing invalid displacement neighbours

This commit is contained in:
Robin Appelman 2022-12-23 14:34:33 +01:00
commit f22ee95214
5 changed files with 39 additions and 18 deletions

View file

@ -1,8 +1,8 @@
use crate::bspfile::LumpType;
use crate::data::*;
use std::num::{ParseFloatError, ParseIntError};
use thiserror::Error;
use zip::result::ZipError;
use crate::bspfile::LumpType;
#[non_exhaustive]
#[derive(Debug, Error)]
@ -105,6 +105,18 @@ pub enum ValidationError {
NonSquareDisplacement(i16),
#[error("No static prop lump found")]
NoStaticPropLump,
#[error(transparent)]
Neighbour(InvalidNeighbourError),
}
#[derive(Debug, Error)]
pub enum InvalidNeighbourError {
#[error("Invalid neighbour span")]
InvalidNeighbourIndex,
#[error("Invalid neighbour span")]
InvalidNeighbourSpan(u8),
#[error("Invalid neighbour orientation")]
InvalidNeighbourOrientation(u8),
}
#[derive(Debug, Error)]