aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-sync.c
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2015-10-30 11:41:13 +0000
committerRichard van der Hoff <richard@matrix.org>2015-10-30 11:41:13 +0000
commit5e45a7d963b848ff9603575948f03927e5ed0b3a (patch)
tree90799f23c5eca38e05f82c1d981484f935817ac9 /matrix-sync.c
parented0c5f6b5ad82df7047296adb081e19102ec4a35 (diff)
downloadpurple-matrix-5e45a7d963b848ff9603575948f03927e5ed0b3a.tar.gz
Fix segfault on homeserver connection drop
If the connection dropped in the middle of us receiving a sync response, we tried to set the next_batch setting on the account to an invalid string (because we failed to initialise the pointer). Fix the segfault that caused, and clean up some of the other error handling in the area at the same time.
Diffstat (limited to 'matrix-sync.c')
-rw-r--r--matrix-sync.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/matrix-sync.c b/matrix-sync.c
index 2f3b887..9190656 100644
--- a/matrix-sync.c
+++ b/matrix-sync.c
@@ -177,6 +177,8 @@ void matrix_sync_parse(PurpleConnection *pc, JsonNode *body,
rooms = matrix_json_object_get_object_member(rootObj, "rooms");
joined_rooms = matrix_json_object_get_object_member(rooms, "joined");
+ *next_batch = matrix_json_object_get_string_member(rootObj, "next_batch");
+
if(joined_rooms == NULL) {
purple_debug_warning("matrixprpl", "didn't find joined rooms list\n");
return;
@@ -187,10 +189,9 @@ void matrix_sync_parse(PurpleConnection *pc, JsonNode *body,
const gchar *room_id = elem->data;
JsonObject *room_data = matrix_json_object_get_object_member(
joined_rooms, room_id);
+ purple_debug_info("matrixprpl", "Syncing room %s", room_id);
matrix_sync_room(room_id, room_data, pc);
}
g_list_free(room_ids);
-
- *next_batch = matrix_json_object_get_string_member(rootObj, "next_batch");
}