summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2024-05-26 08:54:53 +0200
committerMikhail Burakov <mburakov@mailbox.org>2024-05-26 08:54:53 +0200
commitaa3e079a127e25ae91d2d4059a527a70536d5d4d (patch)
tree68dd58e077d6ce755a2de74728c3dcf2a8230310
parent8c2bb886f377d1ac1265ca4c2ac8ebc9f7fdcc5a (diff)
Do not crash when audio capturing is disabled
-rw-r--r--main.c20
1 files changed, 11 insertions, 9 deletions
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;