diff --git a/coding/file_container.hpp b/coding/file_container.hpp index cd5c69a57c..30d231bc76 100644 --- a/coding/file_container.hpp +++ b/coding/file_container.hpp @@ -40,7 +40,15 @@ protected: { bool operator() (Info const & t1, Info const & t2) const { - return (t1.m_offset < t2.m_offset); + if (t1.m_offset == t2.m_offset) + { + // Element with nonzero size should be the last one, + // for correct append writer mode (FilesContainerW::GetWriter). + ASSERT ( t1.m_size == 0 || t2.m_size == 0, (t1.m_size, t2.m_size) ); + return (t1.m_size < t2.m_size); + } + else + return (t1.m_offset < t2.m_offset); } bool operator() (Info const & t1, uint64_t const & t2) const {