From 4a5a0977f661bf5c7c34ee7aa48b35073a682203 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sat, 7 Aug 2010 15:29:08 +0100
Subject: Don't crash when kicked from a MUC.

Resolves: #521

diff --git a/Swiften/Roster/GroupRosterItem.cpp b/Swiften/Roster/GroupRosterItem.cpp
index 8e4be35..bf4f838 100644
--- a/Swiften/Roster/GroupRosterItem.cpp
+++ b/Swiften/Roster/GroupRosterItem.cpp
@@ -64,11 +64,12 @@ void GroupRosterItem::removeAll() {
 		ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(*it);
 		if (contact) {
 			delete contact;
-		} 
-		GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(*it);
-		if (group) {
-			group->removeAll();
-			delete group;
+		} else {
+			GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(*it);
+			if (group) {
+				group->removeAll();
+				delete group;
+			}
 		}
 		it++;
 	}
-- 
cgit v0.10.2-6-g49f6