Do not try to store buddies with empty name and clear m_buddies after storing

This commit is contained in:
Jan Kaluza 2012-07-16 14:38:52 +02:00
parent 851ef18260
commit dd9f9c48e1

View file

@ -86,6 +86,13 @@ RosterStorage::~RosterStorage() {
} }
void RosterStorage::storeBuddy(Buddy *buddy) { void RosterStorage::storeBuddy(Buddy *buddy) {
if (!buddy) {
return;
}
if (buddy->getName().empty()) {
return;
}
m_buddies[buddy->getName()] = buddy; m_buddies[buddy->getName()] = buddy;
m_storageTimer->start(); m_storageTimer->start();
} }
@ -129,6 +136,7 @@ bool RosterStorage::storeBuddies() {
// } // }
} }
m_buddies.clear();
m_storageBackend->commitTransaction(); m_storageBackend->commitTransaction();
return true; return true;
} }