From bcaff4b844470e9f4dc5e7b0de39e87b4722ad1f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 24 Aug 2011 01:46:22 +0200 Subject: output/raop: check if the "host" option is present Better than dereferencing NULL. --- src/output/raop_output_plugin.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/output') 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; -- cgit v1.2.3