stream: check for NULL context

If a stream was killed, the context is cleared. Disconnecting a killed
stream should not crash but return BADSTATE.
This commit is contained in:
Wim Taymans 2020-06-08 11:58:32 +02:00
parent 65798ca566
commit 64fc8dda20

View file

@ -1145,6 +1145,7 @@ int pa_stream_disconnect(pa_stream *s)
spa_assert(s);
spa_assert(s->refcount >= 1);
PA_CHECK_VALIDITY(c, c != NULL, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
pw_log_debug("stream %p: disconnect", s);