diff --git a/src_main/io_devices/pibinarylog.cpp b/src_main/io_devices/pibinarylog.cpp index 40960605..184a070b 100644 --- a/src_main/io_devices/pibinarylog.cpp +++ b/src_main/io_devices/pibinarylog.cpp @@ -142,8 +142,9 @@ bool PIBinaryLog::closeDevice() { is_indexed = false; index.clear(); index_pos.clear(); + bool e = isEmpty(); log_size = 0; - if (canWrite() && isEmpty()) { + if (canWrite() && e) { file.remove(); return true; }