VolumeVerifier: Don't show an assert for files that are too small

This commit is contained in:
JosJuice 2020-01-22 19:06:09 +01:00
parent f8f9dbdec3
commit e449d23929
1 changed files with 22 additions and 17 deletions

View File

@ -1238,9 +1238,6 @@ void VolumeVerifier::Finish()
WaitForAsyncOperations();
ASSERT(m_content_index == m_content_offsets.size());
ASSERT(m_block_index == m_blocks.size());
if (m_calculating_any_hash)
{
if (m_hashes_to_calculate.crc32)
@ -1267,11 +1264,20 @@ void VolumeVerifier::Finish()
if (m_read_errors_occurred)
AddProblem(Severity::Medium, Common::GetStringT("Some of the data could not be read."));
bool file_too_small = false;
if (m_content_index != m_content_offsets.size() || m_block_index != m_blocks.size())
file_too_small = true;
if (IsDisc(m_volume.GetVolumeType()) &&
(m_volume.IsSizeAccurate() || m_volume.SupportsIntegrityCheck()))
{
u64 volume_size = m_volume.IsSizeAccurate() ? m_volume.GetSize() : m_biggest_verified_offset;
if (m_biggest_referenced_offset > volume_size)
file_too_small = true;
}
if (file_too_small)
{
const bool second_layer_missing =
m_biggest_referenced_offset > SL_DVD_SIZE && m_volume.GetSize() >= SL_DVD_SIZE;
@ -1286,7 +1292,6 @@ void VolumeVerifier::Finish()
AddProblem(Severity::High, std::move(text));
return;
}
}
for (auto [partition, blocks] : m_block_errors)
{