pulse: check context (do not user pstream when NULL)
authorMarc-André Lureau <marc-andre.lureau@nokia.com>
Mon, 16 Mar 2009 14:39:28 +0000 (16:39 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 23 Mar 2009 18:38:46 +0000 (19:38 +0100)
src/pulse/stream.c

index 9a0ea0f..a7fccc8 100644 (file)
@@ -948,6 +948,7 @@ static int create_stream(
 
     PA_CHECK_VALIDITY(s->context, s->context->version >= 12 || !(flags & PA_STREAM_VARIABLE_RATE), PA_ERR_NOTSUPPORTED);
     PA_CHECK_VALIDITY(s->context, s->context->version >= 13 || !(flags & PA_STREAM_PEAK_DETECT), PA_ERR_NOTSUPPORTED);
+    PA_CHECK_VALIDITY(s->context, s->context->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     /* Althought some of the other flags are not supported on older
      * version, we don't check for them here, because it doesn't hurt
      * when they are passed but actually not supported. This makes