From aa3e079a127e25ae91d2d4059a527a70536d5d4d Mon Sep 17 00:00:00 2001 From: Mikhail Burakov Date: Sun, 26 May 2024 08:54:53 +0200 Subject: Do not crash when audio capturing is disabled --- main.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 116bf72..9290be3 100644 --- a/main.c +++ b/main.c @@ -305,15 +305,17 @@ static void OnClientConnecting(void* user) { goto drop_client; } - struct Proto proto = { - .size = (uint32_t)strlen(contexts->audio_config) + 1, - .type = PROTO_TYPE_AUDIO, - .flags = PROTO_FLAG_KEYFRAME, - .latency = 0, - }; - if (!WriteProto(contexts->client_fd, &proto, contexts->audio_config)) { - LOG("Failed to write audio configuration"); - goto drop_client; + if (contexts->audio_config) { + struct Proto proto = { + .size = (uint32_t)strlen(contexts->audio_config) + 1, + .type = PROTO_TYPE_AUDIO, + .flags = PROTO_FLAG_KEYFRAME, + .latency = 0, + }; + if (!WriteProto(contexts->client_fd, &proto, contexts->audio_config)) { + LOG("Failed to write audio configuration"); + goto drop_client; + } } return; -- cgit v1.2.3