summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-03-30 07:32:28 (GMT)
committerTobias Markmann <tm@ayena.de>2017-03-31 08:45:43 (GMT)
commit7663ca75731c4313dddbcde4d85f10383644a67a (patch)
treeecb1ed4c08b71bb58efc61980166e5064fefe68e /Swift/Controllers/Roster/Roster.cpp
parent4d0391d824aaf94fbe152778581d51fecd588f6c (diff)
downloadswift-7663ca75731c4313dddbcde4d85f10383644a67a.zip
swift-7663ca75731c4313dddbcde4d85f10383644a67a.tar.bz2
Return unique_ptr instead of pointer to deleted object
Coverity raised this issue. Test-Information: Code builds on macOS 10.12.4 and all unit tests pass; Swift runs fine. Change-Id: I8fb0805f6b2e0a21674ea32c0b1aee9e7b985639
Diffstat (limited to 'Swift/Controllers/Roster/Roster.cpp')
-rw-r--r--Swift/Controllers/Roster/Roster.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Swift/Controllers/Roster/Roster.cpp b/Swift/Controllers/Roster/Roster.cpp
index 9c9b9e3..f6f6ce0 100644
--- a/Swift/Controllers/Roster/Roster.cpp
+++ b/Swift/Controllers/Roster/Roster.cpp
@@ -164,10 +164,10 @@ void Roster::removeContactFromGroup(const JID& jid, const std::string& groupName
while (it != children.end()) {
GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(*it);
if (group && group->getDisplayName() == groupName) {
- ContactRosterItem* deleted = group->removeChild(jid);
+ auto deleted = group->removeChild(jid);
if (itemIt != itemMap_.end()) {
std::vector<ContactRosterItem*>& items = itemIt->second;
- items.erase(std::remove(items.begin(), items.end(), deleted), items.end());
+ items.erase(std::remove(items.begin(), items.end(), deleted.get()), items.end());
}
}
++it;