summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-05-15 02:51:55 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-05-15 02:51:55 +0000
commit067f966a9b5ed7e8e28b5f2b483fb4650da9de88 (patch)
treed79454e3208e5a38a0061340ad30f16ac56b5cd3 /audio
parent865f1108806df04d4bc1b81d08756924e5d52d6a (diff)
Fix default value handling when config file is not present
Diffstat (limited to 'audio')
-rw-r--r--audio/avdtp.c17
-rw-r--r--audio/control.c17
-rw-r--r--audio/main.c3
3 files changed, 20 insertions, 17 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index 7290578b..c74c99e0 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -2940,14 +2940,15 @@ int avdtp_init(GKeyFile *config)
if (avdtp_server)
return 0;
- tmp = g_key_file_get_boolean(config, "General", "Master",
- &err);
- if (err) {
- debug("audio.conf: %s", err->message);
- g_error_free(err);
- err = NULL;
- } else
- master = tmp;
+ if (config) {
+ tmp = g_key_file_get_boolean(config, "General",
+ "Master", &err);
+ if (err) {
+ debug("audio.conf: %s", err->message);
+ g_error_free(err);
+ } else
+ master = tmp;
+ }
avdtp_server = avdtp_server_socket(master);
if (!avdtp_server)
diff --git a/audio/control.c b/audio/control.c
index 6bf05bef..4e8b948d 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -915,14 +915,15 @@ int avrcp_init(DBusConnection *conn, GKeyFile *config)
if (avctp_server)
return 0;
- tmp = g_key_file_get_boolean(config, "General", "Master",
- &err);
- if (err) {
- debug("audio.conf: %s", err->message);
- g_error_free(err);
- err = NULL;
- } else
- master = tmp;
+ if (config) {
+ tmp = g_key_file_get_boolean(config, "General",
+ "Master", &err);
+ if (err) {
+ debug("audio.conf: %s", err->message);
+ g_error_free(err);
+ } else
+ master = tmp;
+ }
connection = dbus_connection_ref(conn);
diff --git a/audio/main.c b/audio/main.c
index ef606223..6419da9a 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -93,7 +93,8 @@ static int audio_init(void)
return -EIO;
}
- g_key_file_free(config);
+ if (config)
+ g_key_file_free(config);
register_service("audio", uuids);