From d2fa4aa5e7faecf274199125297752b812f66442 Mon Sep 17 00:00:00 2001 From: Tobias Jakobi Date: Mon, 10 May 2021 21:23:07 +0200 Subject: [PATCH] screencast: protect against NULL stream in xdpw_pwr_stream_destroy() - this allows repeated calls of xdpw_pwr_stream_destroy() on a single screencast instance --- src/screencast/pipewire_screencast.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/screencast/pipewire_screencast.c b/src/screencast/pipewire_screencast.c index 867d6b1..384ca1b 100644 --- a/src/screencast/pipewire_screencast.c +++ b/src/screencast/pipewire_screencast.c @@ -230,6 +230,10 @@ int xdpw_pwr_context_create(struct xdpw_state *state) { } void xdpw_pwr_stream_destroy(struct xdpw_screencast_instance *cast) { + if (!cast->stream) { + return; + } + logprint(DEBUG, "pipewire: destroying stream"); pw_stream_flush(cast->stream, false); pw_stream_disconnect(cast->stream);