aboutsummaryrefslogtreecommitdiff
path: root/client/acronc/client.c
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2022-08-09 17:12:45 -0700
committerTrumeet <yuuta@yuuta.moe>2022-08-09 17:12:45 -0700
commit1d42944d172cbc725cd025aea1c364c3f13a38e5 (patch)
treedda31a33198ea8d852844861aded05fc0d078c53 /client/acronc/client.c
parentcbe6150992b32f34ecd9cd7e463186fe12e56420 (diff)
downloadacron-1d42944d172cbc725cd025aea1c364c3f13a38e5.tar
acron-1d42944d172cbc725cd025aea1c364c3f13a38e5.tar.gz
acron-1d42944d172cbc725cd025aea1c364c3f13a38e5.tar.bz2
acron-1d42944d172cbc725cd025aea1c364c3f13a38e5.zip
fix(acronc): optional player for AC_EVENT_PLAYER_DISCONNECT
Diffstat (limited to 'client/acronc/client.c')
-rw-r--r--client/acronc/client.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/client/acronc/client.c b/client/acronc/client.c
index d64f96f..4e91d76 100644
--- a/client/acronc/client.c
+++ b/client/acronc/client.c
@@ -41,13 +41,18 @@ static void handle_event(const ac_event_t *event) {
}
case AC_EVENT_PLAYER_DISCONNECT: {
ac_event_player_disconnect_t *o = (ac_event_player_disconnect_t *) event;
- printf("Player '%s' disconnected at %s(%.2f, %.2f, %.2f): %s.\n",
- o->player.name,
- world_name(o->player.world),
- o->player.pos.x,
- o->player.pos.y,
- o->player.pos.z,
- o->reason);
+ if (o->player) {
+ printf("Player '%s' disconnected at %s(%.2f, %.2f, %.2f): %s.\n",
+ o->player->name,
+ world_name(o->player->world),
+ o->player->pos.x,
+ o->player->pos.y,
+ o->player->pos.z,
+ o->reason);
+ } else {
+ printf("Unknown player disconnected: %s.\n",
+ o->reason);
+ }
break;
}
case AC_EVENT_PLAYER_JOIN: {
@@ -120,4 +125,4 @@ int handle_object(ac_obj_t *obj) {
else handle_event((ac_event_t *) obj);
ac_object_free(obj);
return 0;
-} \ No newline at end of file
+}