diff --git a/usrs.cpp b/usrs.cpp index 301b966..979ccb4 100644 --- a/usrs.cpp +++ b/usrs.cpp @@ -51,7 +51,13 @@ UsrSave::UsrSave() { UsrSave::~UsrSave(){ if (not conf.quiet and x_file) fprintf(stderr, "::: USR num recs: %llu \t| EX size: %lu\n", g_record_count-1, x_file->tell()); - DELETE(x_file); + if (x_file) { + if (x_file->has_file()) { + x_file->put(10); + x_file->put_chr(ET_END); + } + delete(x_file); + } } void UsrSave::load_page() { @@ -358,7 +364,10 @@ void UsrLoad::update() { case ET_SOLPF_QLT: m_qlt[0] = m_last.solid_pf_qlt = data; break; - case ET_END: default: assert(0); + case ET_END: + return ; + + default: assert(0); } m_last.index += x_file->get(); } diff --git a/xfile.hpp b/xfile.hpp index c4f4812..fc18b41 100644 --- a/xfile.hpp +++ b/xfile.hpp @@ -59,6 +59,7 @@ class XFileSave : private XFileBase { void put_chr(UCHAR chr); void put_str(const UCHAR* p, size_t len); size_t tell() const ; + bool has_file() const { return !! filer ; } }; class XFileLoad : private XFileBase {