aboutsummaryrefslogtreecommitdiff
path: root/client/helloworld/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/helloworld/main.c')
-rw-r--r--client/helloworld/main.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/client/helloworld/main.c b/client/helloworld/main.c
index c112fcb..cba7e30 100644
--- a/client/helloworld/main.c
+++ b/client/helloworld/main.c
@@ -120,13 +120,17 @@ 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("Unknown player disconnected: %s.\n", o->reason);
+ } else {
+ 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);
+ }
break;
}
case AC_EVENT_PLAYER_JOIN: {
@@ -367,4 +371,4 @@ int main(int argc, char **argv) {
mtx_destroy(&mtx_conn);
#endif
return r;
-} \ No newline at end of file
+}