aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy/empathy-tp-chat.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 8327c4f26..6810476d1 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -886,17 +886,18 @@ chat_lookup_contact (EmpathyTpChat *chat,
for (l = priv->members; l; l = l->next) {
EmpathyContact *c = l->data;
- if (empathy_contact_get_handle (c) == handle) {
- if (remove) {
- /* Caller takes the reference. */
- priv->members = g_list_delete_link (
- priv->members, l);
- } else {
- g_object_ref (c);
- }
+ if (empathy_contact_get_handle (c) != handle) {
+ continue;
+ }
- return c;
+ if (remove) {
+ /* Caller takes the reference. */
+ priv->members = g_list_delete_link (priv->members, l);
+ } else {
+ g_object_ref (c);
}
+
+ return c;
}
return NULL;