Dont panic on unknown file attributes.

This commit is contained in:
Rafał Harabień 2017-10-07 16:25:53 +02:00
parent d32ae0eef9
commit f850c76a1b

View File

@ -294,8 +294,8 @@ pub struct DirIter<'a, 'b: 'a> {
impl <'a, 'b> DirIter<'a, 'b> { impl <'a, 'b> DirIter<'a, 'b> {
fn read_dir_entry_data(&mut self) -> io::Result<DirEntryData> { fn read_dir_entry_data(&mut self) -> io::Result<DirEntryData> {
let mut name = [0; 11]; let mut name = [0; 11];
self.rdr.read(&mut name)?; self.rdr.read_exact(&mut name)?;
let attrs = FileAttributes::from_bits(self.rdr.read_u8()?).expect("invalid attributes"); // FIXME let attrs = FileAttributes::from_bits_truncate(self.rdr.read_u8()?);
if attrs == FileAttributes::LFN { if attrs == FileAttributes::LFN {
let mut data = DirLfnEntryData { let mut data = DirLfnEntryData {
attrs, ..Default::default() attrs, ..Default::default()