diff options
| author | 2010-05-15 12:59:17 +0200 | |
|---|---|---|
| committer | 2010-05-15 12:59:17 +0200 | |
| commit | 78ed9d6448c13c108108b23a9b986992a7f45263 (patch) | |
| tree | 83a83aef4d58be6c787c73d2a834e70cbadc1af5 | |
| parent | 8a776e490d689174cb91d89f43972300d37d4091 (diff) | |
| download | libimobiledevice-78ed9d6448c13c108108b23a9b986992a7f45263.tar.gz libimobiledevice-78ed9d6448c13c108108b23a9b986992a7f45263.tar.bz2  | |
Added checks to make sure entities, is_last_record, and actions aren't NULL.
| -rw-r--r-- | src/mobilesync.c | 22 | 
1 files changed, 14 insertions, 8 deletions
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) {  | 
