changeset 13422:b53fe4fa46b6

[gaim-migrate @ 15797] CID 15 lists an ops->update() call that isn't guarded. I search this whole file and found and fixed a couple more. Resolves CID 15 committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 07 Mar 2006 02:21:37 +0000
parents 2ec69a9763a5
children ae682fa78d7f
files src/blist.c
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Tue Mar 07 02:15:36 2006 +0000
+++ b/src/blist.c	Tue Mar 07 02:21:37 2006 +0000
@@ -1198,7 +1198,8 @@
 		if (cnode->parent->child == cnode)
 			cnode->parent->child = cnode->next;
 
-		ops->remove(gaimbuddylist, cnode);
+		if (ops && ops->remove)
+			ops->remove(gaimbuddylist, cnode);
 		/* ops->remove() cleaned up the cnode's ui_data, so we need to
 		 * reinitialize it */
 		ops->new_node(cnode);
@@ -1302,7 +1303,8 @@
 		if (bnode->parent->child == bnode)
 			bnode->parent->child = bnode->next;
 
-		ops->remove(gaimbuddylist, bnode);
+		if (ops && ops->remove)
+			ops->remove(gaimbuddylist, bnode);
 
 		gaim_blist_schedule_save();
 
@@ -1320,7 +1322,8 @@
 			gaim_blist_remove_contact((GaimContact*)bnode->parent);
 		} else {
 			gaim_contact_invalidate_priority_buddy((GaimContact*)bnode->parent);
-			ops->update(gaimbuddylist, bnode->parent);
+			if (ops && ops->update)
+				ops->update(gaimbuddylist, bnode->parent);
 		}
 	}
 
@@ -1557,7 +1560,8 @@
 			((GaimGroup*)cnode->parent)->currentsize--;
 		((GaimGroup*)cnode->parent)->totalsize--;
 
-		ops->remove(gaimbuddylist, cnode);
+		if (ops && ops->remove)
+			ops->remove(gaimbuddylist, cnode);
 
 		gaim_blist_schedule_save();
 	}
@@ -1587,11 +1591,14 @@
 
 	gaim_blist_schedule_save();
 
-	if (ops && cnode->child)
-		ops->update(gaimbuddylist, cnode);
-
-	for (bnode = cnode->child; bnode; bnode = bnode->next)
-		ops->update(gaimbuddylist, bnode);
+	if (ops && ops->update)
+	{
+		if (cnode->child)
+			ops->update(gaimbuddylist, cnode);
+
+		for (bnode = cnode->child; bnode; bnode = bnode->next)
+			ops->update(gaimbuddylist, bnode);
+	}
 }
 
 void gaim_blist_merge_contact(GaimContact *source, GaimBlistNode *node)
@@ -1652,7 +1659,8 @@
 	if (gaim_find_group(group->name)) {
 		/* This is just being moved */
 
-		ops->remove(gaimbuddylist, (GaimBlistNode *)group);
+		if (ops && ops->remove)
+			ops->remove(gaimbuddylist, (GaimBlistNode *)group);
 
 		if (gnode == gaimbuddylist->root)
 			gaimbuddylist->root = gnode->next;