From bea3559998c0ae0a2afca566046f08d0a201c0b2 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Wed, 16 Dec 2015 18:21:17 +0100 Subject: Fix crash related to removal of contacts Test-Information: Added test@example.com contact and removed it afterwards. Without this patch Swift crashed. With the patch it does not anymore. Change-Id: I09e93340cb0a23291ab094a4cdb7c79ef719645a diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp index 75acaa9..4fbdea4 100644 --- a/Swift/Controllers/Roster/RosterController.cpp +++ b/Swift/Controllers/Roster/RosterController.cpp @@ -334,6 +334,11 @@ void RosterController::handleIncomingPresence(Presence::ref newPresence) { return; } Presence::ref accountPresence = presenceOracle_->getAccountPresence(newPresence->getFrom().toBare()); + if (!accountPresence) { + accountPresence = Presence::create(); + accountPresence->setFrom(newPresence->getFrom()); + accountPresence->setType(Presence::Unavailable); + } roster_->applyOnItems(SetPresence(accountPresence)); } -- cgit v0.10.2-6-g49f6