fix: handle a textools bug explicitly

This commit is contained in:
Anna 2022-09-27 05:17:47 -04:00
parent 17d28d3774
commit 95c90ef66e
2 changed files with 5 additions and 0 deletions

View File

@ -16,4 +16,6 @@ pub enum Error {
SqPackError(#[from] sqpack::binrw::Error),
#[error("error writing to output")]
BinRwWrite(sqpack::binrw::Error),
#[error("a bug in textools corrupted this mod pack")]
TexToolsBug,
}

View File

@ -347,6 +347,9 @@ impl<R: Read> TtmpExtractor<R> {
let mut reader = (&mut reader).take(header.uncompressed_size as u64);
let read = std::io::copy(&mut reader, &mut writer).map_err(Error::Io)?;
(read, read)
} else if header.compressed_size == 0 {
// https://github.com/TexTools/xivModdingFramework/issues/51
return Err(Error::TexToolsBug);
} else {
// compressed
let reader = (&mut reader).take(header.compressed_size as u64);