From: Steinar H. Gunderson Date: Sun, 16 May 2021 13:04:34 +0000 (+0200) Subject: Fix a crash when a HTTP input connected to an UDP output goes unavailable. X-Git-Tag: 1.5.0~15 X-Git-Url: https://git.sesse.net/?p=cubemap;a=commitdiff_plain;h=edf39a7cec7860905689cbec7dd41d7fb3fc8df7;hp=ccad164a0a43a9a026af76d61b35068e7b5d3ab8 Fix a crash when a HTTP input connected to an UDP output goes unavailable. --- diff --git a/serverpool.cpp b/serverpool.cpp index c7ff10c..7b790c2 100644 --- a/serverpool.cpp +++ b/serverpool.cpp @@ -181,10 +181,11 @@ void ServerPool::add_data(int stream_index, const char *data, size_t bytes, uint void ServerPool::set_unavailable(int stream_index) { - assert(stream_index >= 0 && stream_index < ssize_t(num_http_streams)); - - for (int i = 0; i < num_servers; ++i) { - servers[i].set_unavailable(stream_index); + assert(stream_index >= 0 && stream_index < ssize_t(num_http_streams + udp_streams.size())); + if (stream_index < ssize_t(num_http_streams)) { + for (int i = 0; i < num_servers; ++i) { + servers[i].set_unavailable(stream_index); + } } }