]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Fix a crashing bug in cancel_all_RTSP_threads.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 7 Sep 2021 06:44:28 +0000 (07:44 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 7 Sep 2021 06:44:28 +0000 (07:44 +0100)
rtsp.c

diff --git a/rtsp.c b/rtsp.c
index ba8b3fc2d79ad09d2e627be7f7025bd94e8efc4a..244ecd44254aad8a71db137a2ec98ce4c49f9158 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -651,7 +651,7 @@ void cancel_all_RTSP_threads(airplay_stream_c stream_category, int except_this_o
   debug_mutex_lock(&conns_lock, 1000000, 3);
   int i;
   for (i = 0; i < nconns; i++) {
-    if ((conns[i]->running != 0) && (conns[i]->connection_number != except_this_one) &&
+    if ((conns[i] != NULL) && (conns[i]->running != 0) && (conns[i]->connection_number != except_this_one) &&
         ((stream_category == unspecified_stream_category) ||
          (stream_category == conns[i]->airplay_stream_category))) {
       debug(1, "Connection %d: stopped.", conns[i]->connection_number);
@@ -659,7 +659,7 @@ void cancel_all_RTSP_threads(airplay_stream_c stream_category, int except_this_o
     }
   }
   for (i = 0; i < nconns; i++) {
-    if ((conns[i]->running != 0) && (conns[i]->connection_number != except_this_one) &&
+    if ((conns[i] != NULL) && (conns[i]->running != 0) && (conns[i]->connection_number != except_this_one) &&
         ((stream_category == unspecified_stream_category) ||
          (stream_category == conns[i]->airplay_stream_category))) {
       debug(1, "Connection %d: deleted.", conns[i]->connection_number);