Browse Source

* Addressbook: don't save to disk if address map is empty

pull/376/head
hagen 8 years ago
parent
commit
2f2b12811f
  1. 5
      AddressBook.cpp

5
AddressBook.cpp

@ -161,6 +161,11 @@ namespace client @@ -161,6 +161,11 @@ namespace client
int AddressBookFilesystemStorage::Save (const std::map<std::string, i2p::data::IdentHash>& 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

Loading…
Cancel
Save