summaryrefslogtreecommitdiff
path: root/backends/alsa/alsa-toggle.c
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2016-01-04 20:31:14 +0100
committerMichal Ratajsky <[email protected]>2016-01-04 20:31:14 +0100
commit9772797c31ebed2417b42a9389caae1b16847e86 (patch)
tree0257271d6f8387ce89984bf8341b11186381c8d5 /backends/alsa/alsa-toggle.c
parentd32ca3f420d036cd750fc1aad7f95da40559cc5d (diff)
downloadlibmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.bz2
libmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.xz
Improve error checking in many places
Diffstat (limited to 'backends/alsa/alsa-toggle.c')
-rw-r--r--backends/alsa/alsa-toggle.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/backends/alsa/alsa-toggle.c b/backends/alsa/alsa-toggle.c
index 1fee1c1..d143236 100644
--- a/backends/alsa/alsa-toggle.c
+++ b/backends/alsa/alsa-toggle.c
@@ -89,6 +89,12 @@ alsa_toggle_new (AlsaStream *stream,
{
AlsaToggle *toggle;
+ g_return_val_if_fail (ALSA_IS_STREAM (stream), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (ALSA_IS_SWITCH_OPTION (on), NULL);
+ g_return_val_if_fail (ALSA_IS_SWITCH_OPTION (off), NULL);
+
toggle = g_object_new (ALSA_TYPE_TOGGLE,
"name", name,
"label", label,
@@ -166,6 +172,8 @@ alsa_toggle_load (AlsaElement *element)
gint ret;
snd_mixer_selem_channel_id_t c;
+ g_return_val_if_fail (ALSA_IS_TOGGLE (element), FALSE);
+
toggle = ALSA_TOGGLE (element);
if G_UNLIKELY (toggle->priv->element == NULL)