diff options
Diffstat (limited to 'client/libacron/private/serializer.c')
-rw-r--r-- | client/libacron/private/serializer.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/client/libacron/private/serializer.c b/client/libacron/private/serializer.c index 9196305..d5171ba 100644 --- a/client/libacron/private/serializer.c +++ b/client/libacron/private/serializer.c @@ -269,14 +269,20 @@ static int deserialize_event(json_object *obj, const char *type_str, ac_event_t } disconnect->type = AC_EVENT_PLAYER_DISCONNECT; - json_object *arg; - if ((r = get_child(obj, "player", json_type_object, true, &arg))) { + json_object *arg = NULL; + if ((r = get_child(obj, "player", json_type_object, false, &arg))) { ac_object_free((ac_obj_t *) disconnect); goto fail; } - if ((r = deserialize_entity(arg, &disconnect->player))) { - ac_object_free((ac_obj_t *) disconnect); - goto fail; + if (arg) { + if ((r = SALLOC(ac_entity_t, &disconnect->player))) { + ac_object_free((ac_obj_t *) disconnect); + goto fail; + } + if ((r = deserialize_entity(arg, disconnect->player))) { + ac_object_free((ac_obj_t *) disconnect); + goto fail; + } } if ((r = get_child(obj, "reason", json_type_string, true, &arg))) { |