diff --git a/src/rosterstorage.cpp b/src/rosterstorage.cpp index 30679cb9f5edf8b6730ce2677f408c364be46a8b..8716245b4e069e1632b8a68c8a9149a503790f24 100644 --- a/src/rosterstorage.cpp +++ b/src/rosterstorage.cpp @@ -86,6 +86,13 @@ RosterStorage::~RosterStorage() { } void RosterStorage::storeBuddy(Buddy *buddy) { + if (!buddy) { + return; + } + if (buddy->getName().empty()) { + return; + } + m_buddies[buddy->getName()] = buddy; m_storageTimer->start(); } @@ -129,6 +136,7 @@ bool RosterStorage::storeBuddies() { // } } + m_buddies.clear(); m_storageBackend->commitTransaction(); return true; }