From 78ed9d6448c13c108108b23a9b986992a7f45263 Mon Sep 17 00:00:00 2001 From: Bryan Forbes Date: Sat, 15 May 2010 12:59:17 +0200 Subject: Added checks to make sure entities, is_last_record, and actions aren't NULL. --- src/mobilesync.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mobilesync.c b/src/mobilesync.c index db437c4..80666d1 100644 --- a/src/mobilesync.c +++ b/src/mobilesync.c @@ -422,16 +422,22 @@ mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist_ goto out; } - *entities = plist_copy(plist_array_get_item(msg, 2)); + if (entities != NULL) { + *entities = plist_copy(plist_array_get_item(msg, 2)); + } - plist_get_bool_val(plist_array_get_item(msg, 3), &has_more_changes); - *is_last_record = (has_more_changes > 0 ? 0 : 1); + if (is_last_record != NULL) { + plist_get_bool_val(plist_array_get_item(msg, 3), &has_more_changes); + *is_last_record = (has_more_changes > 0 ? 0 : 1); + } - actions_node = plist_array_get_item(msg, 4); - if (plist_get_node_type(actions) == PLIST_DICT) - *actions = plist_copy(actions_node); - else - *actions = NULL; + if (actions != NULL) { + actions_node = plist_array_get_item(msg, 4); + if (plist_get_node_type(actions) == PLIST_DICT) + *actions = plist_copy(actions_node); + else + *actions = NULL; + } out: if (response_type) { -- cgit v1.1-32-gdbae