This commit is contained in:
Robin Appelman 2023-06-08 18:53:23 +02:00
commit 377e1773c0
14 changed files with 2683 additions and 32 deletions

View file

@ -26,7 +26,7 @@ impl Mdl {
body_parts: header
.body_part_indexes()
.map(|index| {
let data = data.get(index..).ok_or_else(|| ModelError::OutOfBounds {
let data = data.get(index..).ok_or(ModelError::OutOfBounds {
data: "BodyPart",
offset: index,
})?;

View file

@ -204,7 +204,7 @@ bitflags! {
impl StudioHeader {
pub fn header2_index(&self) -> Option<usize> {
(self.studio_hdr2_index > 0)
.then(|| self.studio_hdr2_index)
.then_some(self.studio_hdr2_index)
.and_then(|index| usize::try_from(index).ok())
}