From 2f2b12811f1305d382c52727f85d88dae5e3774e Mon Sep 17 00:00:00 2001 From: hagen Date: Thu, 11 Feb 2016 00:00:00 +0000 Subject: [PATCH] * Addressbook: don't save to disk if address map is empty --- AddressBook.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AddressBook.cpp b/AddressBook.cpp index 754d314a..43612506 100644 --- a/AddressBook.cpp +++ b/AddressBook.cpp @@ -161,6 +161,11 @@ namespace client int AddressBookFilesystemStorage::Save (const std::map& addresses) { + if (addresses.size() == 0) { + LogPrint(eLogWarning, "Addressbook: not saving empty addressbook"); + return 0; + } + int num = 0; auto filename = GetPath () / "addresses.csv"; std::ofstream f (filename.string (), std::ofstream::out); // in text mode