Spliting archive creates new parts only when starting to fill them

This commit is contained in:
2021-07-23 14:43:11 +02:00
parent ef871997cf
commit 393586c4ce

View File

@@ -44,7 +44,7 @@ namespace openVulkanoCpp
void MultiPartArchiveWriter::CheckSize(size_t size)
{
if (m_fileSizeLimit < m_writer->GetTotalWrittenBytes() + size)
if (!m_writer || m_fileSizeLimit < m_writer->GetTotalWrittenBytes() + size)
{
StartNewFile();
}
@@ -105,6 +105,6 @@ namespace openVulkanoCpp
void MultiPartArchiveWriter::Split()
{
if (!m_writer->GetTotalWrittenBytes()) return; // Nothing has been written yet, no need to split file
StartNewFile();
m_writer = nullptr;
}
}