From cc7c626e69dde909443831398c28c2ee05f8279c Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Mon, 20 Oct 2014 16:19:36 +0200 Subject: [PATCH] module-card/device-restore: Do not legacy load an empty entry There is no use in trying to load data in legacy format, if we already know that there is no data at all. Also clarify in the debug message whether there is invalid data or no data at all. Signed-off-by: David Henningsson --- src/modules/module-card-restore.c | 6 ++++-- src/modules/module-device-restore.c | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c index 5b026020e..681acca60 100644 --- a/src/modules/module-card-restore.c +++ b/src/modules/module-card-restore.c @@ -269,8 +269,10 @@ static struct entry* entry_read(struct userdata *u, const char *name) { pa_zero(data); - if (!pa_database_get(u->database, &key, &data)) - goto fail; + if (!pa_database_get(u->database, &key, &data)) { + pa_log_debug("Database contains no data for key: %s", name); + return NULL; + } t = pa_tagstruct_new(data.data, data.size); e = entry_new(); diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c index b7f172fc6..cb42207ef 100644 --- a/src/modules/module-device-restore.c +++ b/src/modules/module-device-restore.c @@ -233,8 +233,10 @@ static struct entry* entry_read(struct userdata *u, const char *name) { pa_zero(data); - if (!pa_database_get(u->database, &key, &data)) - goto fail; + if (!pa_database_get(u->database, &key, &data)) { + pa_log_debug("Database contains no data for key: %s", name); + return NULL; + } t = pa_tagstruct_new(data.data, data.size); e = entry_new(); @@ -477,7 +479,7 @@ fail: } #endif - pa_log_debug("Database contains invalid data for key: %s", name); + pa_log_debug("Database contains no (or invalid) data for key: %s", name); pa_xfree(name);