screencast: protect against NULL stream in xdpw_pwr_stream_destroy()

- this allows repeated calls of xdpw_pwr_stream_destroy() on a
  single screencast instance
This commit is contained in:
Tobias Jakobi 2021-05-10 21:23:07 +02:00 committed by Simon Ser
parent dbe71a66c7
commit d2fa4aa5e7

View file

@ -230,6 +230,10 @@ int xdpw_pwr_context_create(struct xdpw_state *state) {
} }
void xdpw_pwr_stream_destroy(struct xdpw_screencast_instance *cast) { void xdpw_pwr_stream_destroy(struct xdpw_screencast_instance *cast) {
if (!cast->stream) {
return;
}
logprint(DEBUG, "pipewire: destroying stream"); logprint(DEBUG, "pipewire: destroying stream");
pw_stream_flush(cast->stream, false); pw_stream_flush(cast->stream, false);
pw_stream_disconnect(cast->stream); pw_stream_disconnect(cast->stream);