]> git.0d.be Git - jack_mixer.git/commitdiff
Guard Channel_set_volume() against unitialized channel
authorFrédéric Péters <fpeters@0d.be>
Wed, 16 Dec 2009 14:07:57 +0000 (15:07 +0100)
committerFrédéric Péters <fpeters@0d.be>
Wed, 16 Dec 2009 14:07:57 +0000 (15:07 +0100)
jack_mixer_c.c

index a1b400e0bfd15aaa5d088d4bab98535ac2a28ce1..049a2b2339d1f29306fea6627cd37990dee43192 100644 (file)
@@ -211,6 +211,10 @@ Channel_get_volume(ChannelObject *self, void *closure)
 static int
 Channel_set_volume(ChannelObject *self, PyObject *value, void *closure)
 {
+       if (self->channel == NULL) {
+               PyErr_SetString(PyExc_RuntimeError, "unitialized channel");
+               return -1;
+       }
        channel_volume_write(self->channel, PyFloat_AsDouble(value));
        return 0;
 }