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/pulse/pulse-stream-control.c | |
parent | d32ca3f420d036cd750fc1aad7f95da40559cc5d (diff) | |
download | libmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.bz2 libmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.xz |
Improve error checking in many places
Diffstat (limited to 'backends/pulse/pulse-stream-control.c')
-rw-r--r-- | backends/pulse/pulse-stream-control.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/backends/pulse/pulse-stream-control.c b/backends/pulse/pulse-stream-control.c index bc59c97..fe4304c 100644 --- a/backends/pulse/pulse-stream-control.c +++ b/backends/pulse/pulse-stream-control.c @@ -308,14 +308,19 @@ pulse_stream_control_get_channel_map (PulseStreamControl *control) } void -pulse_stream_control_set_app_info (PulseStreamControl *control, MateMixerAppInfo *info) +pulse_stream_control_set_app_info (PulseStreamControl *control, + MateMixerAppInfo *info, + gboolean take) { g_return_if_fail (PULSE_IS_STREAM_CONTROL (control)); - if G_UNLIKELY (control->priv->app_info) + if G_UNLIKELY (control->priv->app_info != NULL) _mate_mixer_app_info_free (control->priv->app_info); - control->priv->app_info = info; + if (take == TRUE) + control->priv->app_info = info; + else + control->priv->app_info = _mate_mixer_app_info_copy (info); } void @@ -324,11 +329,10 @@ pulse_stream_control_set_channel_map (PulseStreamControl *control, const pa_chan MateMixerStreamControlFlags flags; g_return_if_fail (PULSE_IS_STREAM_CONTROL (control)); - g_return_if_fail (map != NULL); flags = mate_mixer_stream_control_get_flags (MATE_MIXER_STREAM_CONTROL (control)); - if (pa_channel_map_valid (map)) { + if (map != NULL && pa_channel_map_valid (map)) { if (pa_channel_map_can_balance (map)) flags |= MATE_MIXER_STREAM_CONTROL_CAN_BALANCE; else |