From dd9f9c48e1ed43884c36c8f2774085ece9eee7da Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Mon, 16 Jul 2012 14:38:52 +0200 Subject: [PATCH] Do not try to store buddies with empty name and clear m_buddies after storing --- src/rosterstorage.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rosterstorage.cpp b/src/rosterstorage.cpp index 30679cb9..8716245b 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; }