diff options
author | Max Kellermann <max@duempel.org> | 2011-08-24 01:46:22 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-08-24 01:47:31 +0200 |
commit | bcaff4b844470e9f4dc5e7b0de39e87b4722ad1f (patch) | |
tree | bfa4524fe8c6bcb045747c07125fdb38f91b3439 | |
parent | 82f336a78f924782256bbadab4b608db8499b359 (diff) | |
download | mpd-bcaff4b844470e9f4dc5e7b0de39e87b4722ad1f.tar.gz mpd-bcaff4b844470e9f4dc5e7b0de39e87b4722ad1f.tar.xz mpd-bcaff4b844470e9f4dc5e7b0de39e87b4722ad1f.zip |
output/raop: check if the "host" option is present
Better than dereferencing NULL.
Diffstat (limited to '')
-rw-r--r-- | src/output/raop_output_plugin.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/output/raop_output_plugin.c b/src/output/raop_output_plugin.c index ff15c09d4..02ca120a0 100644 --- a/src/output/raop_output_plugin.c +++ b/src/output/raop_output_plugin.c @@ -1187,13 +1187,20 @@ raop_output_init(G_GNUC_UNUSED const struct audio_format *audio_format, G_GNUC_UNUSED const struct config_param *param, GError **error_r) { + const char *host = config_get_block_string(param, "host", NULL); + if (host == NULL) { + g_set_error_literal(error_r, raop_output_quark(), 0, + "missing option 'host'"); + return NULL; + } + struct raop_data *rd; rd = new_raop_data(error_r); if (rd == NULL) return NULL; - rd->addr = config_get_block_string(param, "host", NULL); + rd->addr = host; rd->rtsp_port = config_get_block_unsigned(param, "port", 5000); rd->volume = config_get_block_unsigned(param, "volume", 75); return rd; |