use wrapping_add here so this doesn't panic when loading non-.dat data

This commit is contained in:
Gered 2021-05-25 10:45:28 -04:00
parent 9dc6e0815e
commit d27d9ad072

View file

@ -201,7 +201,7 @@ impl QuestDat {
break; break;
} }
if table_size != table_body_size + QUEST_DAT_TABLE_HEADER_SIZE as u32 { if table_size != table_body_size.wrapping_add(QUEST_DAT_TABLE_HEADER_SIZE as u32) {
return Err(QuestDatError::DataFormatError(format!( return Err(QuestDatError::DataFormatError(format!(
"Malformed table at index {}. table_size != table_body_size + 16", "Malformed table at index {}. table_size != table_body_size + 16",
index index