summaryrefslogtreecommitdiff
path: root/backends/pulse/pulse-sink.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/pulse/pulse-sink.c
parentd32ca3f420d036cd750fc1aad7f95da40559cc5d (diff)
downloadlibmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.bz2
libmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.xz
Improve error checking in many places
Diffstat (limited to 'backends/pulse/pulse-sink.c')
-rw-r--r--backends/pulse/pulse-sink.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/backends/pulse/pulse-sink.c b/backends/pulse/pulse-sink.c
index 294643c..616331b 100644
--- a/backends/pulse/pulse-sink.c
+++ b/backends/pulse/pulse-sink.c
@@ -130,6 +130,7 @@ pulse_sink_new (PulseConnection *connection,
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), NULL);
g_return_val_if_fail (info != NULL, NULL);
+ g_return_val_if_fail (device == NULL || PULSE_IS_DEVICE (device), NULL);
sink = g_object_new (PULSE_TYPE_SINK,
"name", info->name,
@@ -189,6 +190,9 @@ pulse_sink_add_input (PulseSink *sink, const pa_sink_input_info *info)
{
PulseSinkInput *input;
+ g_return_val_if_fail (PULSE_IS_SINK (sink), FALSE);
+ g_return_val_if_fail (info != NULL, FALSE);
+
/* This function is used for both creating and refreshing sink inputs */
input = g_hash_table_lookup (sink->priv->inputs, GUINT_TO_POINTER (info->index));
if (input == NULL) {
@@ -218,6 +222,8 @@ pulse_sink_remove_input (PulseSink *sink, guint32 index)
PulseSinkInput *input;
gchar *name;
+ g_return_if_fail (PULSE_IS_SINK (sink));
+
input = g_hash_table_lookup (sink->priv->inputs, GUINT_TO_POINTER (index));
if G_UNLIKELY (input == NULL)
return;