Add null seat pointer checks

v0.7
Christopher Snowhill 2023-10-13 19:37:07 -07:00 committed by Andri Yngvason
parent 53cc5d185c
commit e035f642a6
1 changed files with 3 additions and 3 deletions

View File

@ -527,7 +527,7 @@ static void client_info(const struct ctl_server_client* client_handle,
info->id = client->id; info->id = client->id;
info->hostname = nvnc_client_get_hostname(vnc_client); info->hostname = nvnc_client_get_hostname(vnc_client);
info->username = nvnc_client_get_auth_username(vnc_client); info->username = nvnc_client_get_auth_username(vnc_client);
info->seat = client->seat->name; info->seat = client->seat ? client->seat->name : NULL;
} }
static int get_output_list(struct ctl* ctl, static int get_output_list(struct ctl* ctl,
@ -1095,7 +1095,7 @@ static void client_destroy(void* obj)
.id = self->id, .id = self->id,
.hostname = nvnc_client_get_hostname(self->nvnc_client), .hostname = nvnc_client_get_hostname(self->nvnc_client),
.username = nvnc_client_get_auth_username(self->nvnc_client), .username = nvnc_client_get_auth_username(self->nvnc_client),
.seat = self->seat->name, .seat = self->seat ? self->seat->name : NULL,
}; };
ctl_server_event_disconnected(wayvnc->ctl, &info, wayvnc->nr_clients); ctl_server_event_disconnected(wayvnc->ctl, &info, wayvnc->nr_clients);
@ -1143,7 +1143,7 @@ static void on_nvnc_client_new(struct nvnc_client* client)
.id = wayvnc_client->id, .id = wayvnc_client->id,
.hostname = nvnc_client_get_hostname(client), .hostname = nvnc_client_get_hostname(client),
.username = nvnc_client_get_auth_username(client), .username = nvnc_client_get_auth_username(client),
.seat = wayvnc_client->seat->name, .seat = wayvnc_client->seat ? wayvnc_client->seat->name : NULL,
}; };
ctl_server_event_connected(self->ctl, &info, self->nr_clients); ctl_server_event_connected(self->ctl, &info, self->nr_clients);