From 19499bf2f61d453691b4a13c93125a005cea5e18 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Tue, 1 Sep 2015 16:46:48 +0200 Subject: [PATCH] FIX: if storage doesn't have a card for LAST, don't complain & no fake things --- storage.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/storage.c b/storage.c index 0ac8f52..01b36e3 100644 --- a/storage.c +++ b/storage.c @@ -91,7 +91,7 @@ static int user_device_list(char *name, int level, JsonNode *obj) void append_device_details(JsonNode *userlist, char *user, char *device) { - char path[BUFSIZ], *ghash; + char path[BUFSIZ]; JsonNode *node, *last, *card; snprintf(path, BUFSIZ, "%s/last/%s/%s/%s-%s.json", @@ -111,20 +111,14 @@ void append_device_details(JsonNode *userlist, char *user, char *device) if (json_copy_from_file(card, path) == TRUE) { json_copy_to_object(last, card, FALSE); } else { - /* No CARD? Add pseudo data */ - - json_append_member(last, "name", json_mknull()); - json_append_member(last, "face", json_mknull()); + json_delete(card); } if ((node = json_find_member(last, "ghash")) != NULL) { - - ghash = node->string_; - - get_geo(last, ghash); + if (node->tag == JSON_STRING) { + get_geo(last, node->string_); + } } - - } /*