diff options
author | Michal Ratajsky <[email protected]> | 2016-01-04 20:31:14 +0100 |
---|---|---|
committer | Michal Ratajsky <[email protected]> | 2016-01-04 20:31:14 +0100 |
commit | 9772797c31ebed2417b42a9389caae1b16847e86 (patch) | |
tree | 0257271d6f8387ce89984bf8341b11186381c8d5 /backends/oss/oss-stream.c | |
parent | d32ca3f420d036cd750fc1aad7f95da40559cc5d (diff) | |
download | libmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.bz2 libmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.xz |
Improve error checking in many places
Diffstat (limited to 'backends/oss/oss-stream.c')
-rw-r--r-- | backends/oss/oss-stream.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/backends/oss/oss-stream.c b/backends/oss/oss-stream.c index 0e7a0c0..f094537 100644 --- a/backends/oss/oss-stream.c +++ b/backends/oss/oss-stream.c @@ -21,6 +21,7 @@ #include <libmatemixer/matemixer.h> #include <libmatemixer/matemixer-private.h> +#include "oss-device.h" #include "oss-stream.h" #include "oss-stream-control.h" #include "oss-switch.h" @@ -93,7 +94,12 @@ oss_stream_new (const gchar *name, MateMixerDevice *device, MateMixerDirection direction) { - const gchar *label = mate_mixer_device_get_label (device); + const gchar *label; + + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (OSS_IS_DEVICE (device), NULL); + + label = mate_mixer_device_get_label (device); return g_object_new (OSS_TYPE_STREAM, "name", name, @@ -208,6 +214,8 @@ oss_stream_set_switch_data (OssStream *stream, gint fd, GList *options) _("Connector"), fd, options); + if G_UNLIKELY (stream->priv->swtch == NULL) + return; /* Read the active selection */ oss_switch_load (stream->priv->swtch); |